Q
韩文语言分割器
5
A
回答
2
POSTECH/K是一款韩国形态分析仪,可以在不费力气的情况下对韩国数据进行标记和标记。该软件在训练和测试的语料库上报告了90.7%(参见http://nlp.postech.ac.kr/download/postag_k/9908_cljournal_gblee.pdf)。
对于我一直在努力的multilingual corpus project的韩国数据,POS标签达到了81%。
但是,有一个问题,你必须使用Windows来运行软件。但我有一个脚本来绕过限制,这里的脚本:
#!/bin/bash -x
###############################################################################
## Sejong-Shell is a script to call POSTAG/SEJONG tagger on Unix Machine
## because POSTAG/Sejong is only usable in Korean Microsoft Windows environment
## the original POSTAG/Sejong can be downloaded from
## http://isoft.postech.ac.kr/Course/CS730b/2005/index.html
##
## Sejong-Shell is dependent on WINdows Emulator.
## The WINE program can be downloaded from
## http://www.winehq.org/download/
##
## The shell scripts accepts the input files from one directory and
## outputs the tagged files into another while retaining the filename
###############################################################################
cd <source-file_dir>
#<source_-ile_dir> is the directory that saves the textfiles that needs tagging
for file in `dir -d *`
do
echo $file
sudo cp <source-file_dir>/"$file" <POSTAG-Sejong_dir>/input.txt
# <POSTAG-Sejong_dir> refers to the directory where the pos-tagger is saved
wine start /Unix "$HOME/postagsejong/sjTaggerInteg.exe"
sleep 30
# This is necessary so that the file from the current loop won't be
# overlapping with the next, do increase the time for sleep if the file
# is large and needs more than 30 sec for POSTAG/Sejong to tag.
sudo cp <POSTAG-Sejong_dir>/output.txt <target-file_dir>/"$file"
# <target-file_dir> is where you want the output files to be stored
done
# Instead of the sleep command to prevent the overlap:
# $sleep 30
# Alternatively, you can manually continue a loop with the following
# command that continues a loop after a keystroke input:
# $read -p "Press any key to continue…"
注意,对于POSTECH/K编码是euc-kr
,所以如果它是utf8
。您可以使用以下脚本将utf8转换为euc-kr。
#!/usr/bin/python # -*- coding: utf-8 -*-
'''
pre-sejong clean
'''
import codecs
import nltk
import os, sys, re, glob
from nltk.tokenize import RegexpTokenizer
reload(sys)
sys.setdefaultencoding('utf-8')
cwd = './gizaclean_ko' #os.getcwd()
wrd = './presejong_ko'
kr_sent_tokenizer = nltk.RegexpTokenizer(u'[^!?.?!]*[!?."www.*"]')
for infile in glob.glob(os.path.join(cwd, '*.txt')):
# if infile == './extract_ko/singapore-sling.txt': continue
# if infile == './extract_ko/ion-orchard.txt': continue
print infile
(PATH, FILENAME) = os.path.split(infile)
reader = open(infile)
writer = open(os.path.join(wrd, FILENAME).encode('euc-kr'),'w')
for line in reader:
para = []urlread = lambda url: urllib.urlopen(url).read()
para.append (kr_sent_tokenizer.tokenize(unicode(line,'utf-8').strip()))
for sent in para[0]:
newsent = sent.replace(u'\xa0', ' '.encode('utf-8'))
newsent2 = newsent.replace(u'\xe7', 'c'.encode('utf-8'))
newsent3 = newsent2.replace(u'\xe9', 'e'.encode('utf-8'))
newsent4 = newsent3.replace(u'\u2013', '-')
newsent5 = newsent4.replace(u'\xa9', '(c)')
newsent6 = newsent5.encode('euc-kr').strip()
print newsent6
writer.write(newsent6+'\n')
(源世宗壳:醴陵谭2011年建立的南洋理工大学的基础文本 - 多语言语料库(NTU-MC)最后一年的项目新加坡:新加坡南洋理工大学第。 44.)
0
我建议你使用这个site。它的性能非常好,虽然它只是作为RESTful服务提供的功能。
相关问题
- 1. NSString isEqualToString:不等同于韩文语言。
- 2. 分割的C语言
- 3. 分割用汇编语言
- 4. 多国语言网站 - 英语,日语,韩语语言
- 5. C地块分割c语言
- 6. 分割过错树在C语言
- 7. 中文,日文等非拉丁语言的分割规则
- 8. 阅读包括俄语,韩语等各种语言的网页
- 9. YouTube Api(搜索)其他语言..(阿拉伯语,韩语等....)
- 10. 用于日语,中文和韩语等语言的KeyUp/KeyDown替代方案?
- 11. 多语言的MFC应用程序 - 英语,法语,西班牙语和韩语
- 12. 拉丁语基础语言分割格式规则
- 13. 韩语支持iPad模拟器丢失
- 14. Python语言的语法分析器
- 15. 如何将Hangul(韩语)写入文件?
- 16. Php分割语句
- 17. 俄语语言的文本分类
- 18. 在韩语解析日期
- 19. Android的TTS与韩语
- 20. 分割错误C语言读取简单字
- 21. C语言编程的fscanf分割错误
- 22. 汇编语言中的“分割”字符串
- 23. 极难找到的错误。分割错误 - C语言
- 24. 用C语言中的isdigit()分割错误?
- 25. WPF应用程序上的MaxLength对于韩语语言不起作用
- 26. 使用亚洲语言(韩语,日语,中文)在Java swing(JPasswordField)中设置密码不起作用
- 27. 如何分割以C#语言实现的字节的wmv文件?
- 28. VDM ++语言分号
- 29. ibm bluemix自然语言分类器/
- 30. nhibernate.search/lucene.net多语言分析器
您正在寻找免费/ OSS tokenizer,不是吗?恐怕我知道CJKV语言的唯一标记器或多或少地正确工作,这是商业化的东西。 –