hit-scir / scir-training-day Goto Github PK
View Code? Open in Web Editor NEWa small training program for new crews of HIT-SCIR
a small training program for new crews of HIT-SCIR
HMM那块又有个编译问题,文章中写的这句代码运行有错误,还是看不懂
$python eval_gene_tagger.py gene.key gene.dev
Could not align gold standard and predictions in line 1.
Gold standard: BACKGROUND Prediction file:
你好,在正向最大匹配分词练习里,我在文件eval.py
遇到了编译错误,错误如下:
Traceback (most recent call last):
File "eval.py", line 175, in <module>
num_recall, num_pred, num_gold = evaluate(pred_inst, gold_inst, opt.mode)
File "eval.py", line 34, in evaluate
assert (pred.raw == gold.raw)
AssertionError
我的最大匹配分词代码如下:
def max_match_segment(line, dic):
# write your code here
# line = line.decode('utf-8')
s = "" # pattern正常窗口
s_f = "" # pattern前倾一位窗口
ret = []
tmp = set()
for cur_word in line: # line 为str
s = s_f
s_f += cur_word # s_f前倾一位
if len(tmp) == 0: # 新词典为空,构建新词典 s_f是word子串,把word加入新词典
tmp = set([word for word in dic if s_f in word])
else: # 新词典不为空,遍历对比, 移除词典中不符合条件的词
tmp = set([elem for elem in tmp if s_f in elem])
if len(tmp) == 0: # 匹配到最大词,加入列表
ret.append(s)
s_f = "" + cur_word # 重置前倾
return ret
我是mac系统,最后输出到output.dat文件中是乱码的,在decode再encode成UTF-8编码后虽然文字没问题,但是运行python eval.py --format=segment --mode=segment --eval=output.dat --gold=eval.dat
依旧是同样的编译错误,不知道是什么原因呢?
It means a lot to us and future machine learning scientists.
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.