beyondacm / autochecker4chinese Goto Github PK
View Code? Open in Web Editor NEW中文文本错别字检测以及自动纠错 / Autochecker & autocorrecter for chinese
中文文本错别字检测以及自动纠错 / Autochecker & autocorrecter for chinese
hi,where is the pinyin file ?
一公司的面试题 😂
Traceback (most recent call last):
File "Autochecker4Chinese.py", line 128, in
main()
File "Autochecker4Chinese.py", line 117, in main
correct_sent = auto_correct_sentence( err_sent_1 )
File "Autochecker4Chinese.py", line 99, in auto_correct_sentence
correct_phrase = auto_correct(phrase.encode("utf-8"))
File "Autochecker4Chinese.py", line 76, in auto_correct
c1_order, c2_order, c3_order = get_candidates(error_phrase)
File "Autochecker4Chinese.py", line 58, in get_candidates
error_pinyin = pinyin.get(error_phrase, format="strip", delimiter="/")#.encode("utf-8")
Thanks a lot!
在入场生活中,可能用各种语言开发,而http是最方便的
我看到如下代码, 似乎只考虑了单词的频率,而没有结合语境考虑问题. 感觉需要改进算法
def auto_correct( error_phrase ):
c1_order, c2_order, c3_order = get_candidates(error_phrase)
# print c1_order, c2_order, c3_order
if c1_order:
return max(c1_order, key=phrase_freq.get )
elif c2_order:
return max(c2_order, key=phrase_freq.get )
else:
return max(c3_order, key=phrase_freq.get )
I think the follow function needs a small change, and I marked it by ****. Because when you using "max(c1_order, key=phrase_freq.get )", the type of data maybe string.
def construct_dict( file_path ):
word_freq = {}
with open(file_path, mode='r', encoding='UTF-8') as f:
for line in f:
info = line.split()
word = info[0]
frequency = info[1] -------------- frequency = int(info[1])
word_freq[word] = frequency
return word_freq
机七-->机
并没有纠正“七”,这是哪里出了问题?
There are so many problems when I ran your program, and I list all of them:
Please list all the denpendent libraies and operating environment. Your program seems base on python2, please make the statement that other reader can understand first.
reload
and ys.setdefaultencoding('utf-8')
functions could not be found. I tried to remove both of them, however a series problem occurred.
Thank for your contribution, hope you can solve these problems soon
请问这是在python2上运行的吗
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.