所以我实际上已经开始制作一个英语到 Babel 的翻译器,并且进展顺利。我只花了几个小时,它已经完美地适用于我三分之一的测试例句。
我采用了 OpenNLP 解析器的(SharpNLP 端口),该解析器生成 Penn Treebank 格式的英语句子解析,然后我步行创建 Babel。
现在可以通过http://translator.babelproject.com/EnglishToBabel.aspx 获得它,来试试吧。
第一行将是英文句子的回声。第二个是OpenNLP生成的解析树,最后每个输出的第三行就是生成的Babel。
这一切都是用 C# 构建的。如果你想要它的来源,请告诉我。
SharpNLP 解析器有点糟糕,它在例句中得到了一些糟糕的解析。显然它是旧版本 OpenNLP 的移植。我可能会切换到斯坦福解析器,它似乎可以提供更好的解析结果。最先进的解析器准确率似乎约为 90%。
这是它的当前输出示例。我正在努力将它连接到一个交互式小说游戏引擎。 :)
The quick brown fox jumped over the lazy dog.
(TOP (S (NP (DT The) (JJ quick) (JJ brown) (NN fox)) (VP (VBD jumped) (PP (IN over) (NP (DT the) (JJ lazy) (NN dog)))) (. .)))
Fox quick brown.jumped- over[Dog lazy]();
A quick brown fox is jumping over the lazy dog.
(TOP (S (NP (DT A) (JJ quick) (JJ brown) (NN fox)) (VP (VBZ is) (VP (VBG jumping) (PRT (RP over)) (NP (DT the) (JJ lazy) (NN dog)))) (. .)))
Fox quick brown.is(jumping(Dog lazy));
You are standing at the end of a road before a small brick building.
(TOP (S (NP (PRP You)) (VP (VBP are) (VP (VBG standing) (PP (IN at) (NP (NP (DT the) (NN end)) (PP (IN of) (NP (DT a) (NN road))))) (PP (IN before) (NP (DT a) (JJ small) (NN brick) (NN building))))) (. .)))
You.are(standing at[End of[Road]] before[Building small]());
Around you is a forest.
(TOP (S (SBAR (IN Around) (S (NP (PRP you)) (VP (VBZ is) (NP (DT a) (NN forest))))) (. .)))
There is a forest around you.
(TOP (S (NP (EX There)) (VP (VBZ is) (NP (DT a) (NN forest)) (PP (IN around) (NP (PRP you)))) (. .)))
is around[You](Forest);
A forest is around you.
(TOP (S (NP (DT A) (NN forest)) (VP (VBZ is) (PP (IN around) (NP (PRP you)))) (. .)))
Forest.is around[You]();
A small stream flows out of the building and down a gully.
(TOP (S (NP (DT A) (JJ small) (NN stream)) (VP (VBZ flows) (PP (PP (IN out) (PP (IN of) (NP (DT the) (NN building)))) (CC and) (PP (IN down) (NP (DT a) (NN gully))))) (. .)))
Stream small.flows();
I ate cheese.
(TOP (S (NP (PRP I)) (VP (VBD ate) (NP (NN cheese))) (. .)))
I.ate-(Cheese);
I will eat cheese.
(TOP (S (NP (PRP I)) (VP (MD will) (VP (VB eat) (NP (NN cheese)))) (. .)))
I.will(eat(Cheese));
My dog ran quickly.
(TOP (S (NP (PRP$ My) (NN dog)) (VP (VBD ran) (ADVP (RB quickly))) (. .)))
Dog.ran- quickly();
See Jane run.
(TOP (S (VP (VB See) (NP (NNP Jane) (NN run))) (. .)))
see(Run);
Joe is tall.
(TOP (S (NP (NNP Joe)) (VP (VBZ is) (ADJP (JJ tall))) (. .)))
Joe.is(tall);
Joe was tall.
(TOP (S (NP (NNP Joe)) (VP (VBD was) (ADJP (JJ tall))) (. .)))
Joe.was-(tall);
Joe is a human.
(TOP (S (NP (NNP Joe)) (VP (VBZ is) (NP (DT a) (JJ human))) (. .)))
Joe.is();
The chickens are running loose today.
(TOP (S (NP (DT The) (NNS chickens)) (VP (VBP are) (VP (VBG running) (S (ADJP (RB loose))) (NP (NN today)))) (. .)))
Chickens*.are(running(Today));
Chickens were running loose.
(TOP (S (NP (NNS Chickens)) (VP (VBD were) (VP (VBG running) (ADVP (RB loose)))) (. .)))
Chickens*.were-(running loose());
Before you go to school, take out the trash.
(TOP (S (SBAR (IN Before) (S (NP (PRP you)) (VP (VBP go) (PP (TO to) (NP (NN school)))))) (, ,) (VP (VB take) (PRT (RP out)) (NP (DT the) (NN trash))) (. .)))
take(Trash);
What is the color of horse that I am riding?
(TOP (SBARQ (WHNP (WP What)) (SQ (VP (VBZ is) (NP (NP (NP (DT the) (NN color)) (PP (IN of) (NP (NN horse)))) (SBAR (WHNP (IN that)) (S (NP (PRP I)) (VP (VBP am) (VP (VBG riding)))))))) (. ?)))
The horse that I was riding died.
(TOP (FRAG (NP (NP (DT The) (NN horse)) (SBAR (WHNP (IN that)) (S (NP (PRP I)) (VP (VBD was) (VP (VBG riding) (VP (VBD died))))))) (. .)))
Is Joe tall?
(TOP (SQ (VBZ Is) (NP (NNP Joe) (NN tall)) (. ?)))
Tall.is();
Where is Joe? Sam ate the oranges.
(TOP (S (SBARQ (WHADVP (WRB Where)) (SQ (VP (VBZ is)) (NP (NNP Joe))) (. ?)) (NP (NNP Sam)) (VP (VBD ate) (NP (DT the) (NNS oranges))) (. .)))
Sam.ate-(Oranges*);
Samson slept.
(TOP (S (NP (NNP Samson)) (VP (VBD slept)) (. .)))
Samson.slept-();
Sit!
(TOP (S (VP (VB Sit)) (. !)))
sit();
Where are you going?
(TOP (SBARQ (WHADVP (WRB Where)) (SQ (VBP are) (NP (PRP you)) (VP (VBG going))) (. ?)))
You were reading this morning.
(TOP (S (NP (PRP You)) (VP (VBD were) (VP (VBG reading) (NP (DT this) (NN morning)))) (. .)))
You.were-(reading(Morning));
The morning of today, you read.
(TOP (S (NP (NP (DT The) (NN morning)) (PP (IN of) (NP (NN today)))) (, ,) (NP (PRP you)) (VP (VBD read)) (. .)))
You.read-();
What were you reading this morning?
(TOP (SBARQ (WHNP (WP What)) (SQ (VBD were) (NP (PRP you)) (VP (VBG reading) (NP (DT this) (NN morning)))) (. ?)))
Whose bike were you using?
(TOP (S (NP (WP$ Whose) (NN bike)) (VP (VBD were) (S (NP (PRP you)) (VP (VBG using)))) (. ?)))
Bike.were-();
You bought the bike that you use.
(TOP (S (NP (PRP You)) (VP (VBD bought) (NP (DT the) (NN bike)) (SBAR (IN that) (S (NP (PRP you)) (VP (VBP use))))) (. .)))
You.bought-(Bike);
May I postpone this assignment?
(TOP (SQ (MD May) (NP (PRP I)) (VP (VB postpone) (NP (DT this) (NN assignment))) (. ?)))
I.postpone(Assignment);
Juanita and Celso worked hard and then rested.
(TOP (S (NP (NP (NNP Juanita)) (CC and) (NP (NNP Celso))) (VP (VBD worked) (ADVP (RB hard) (CC and) (RB then) (VBD rested))) (. .)))
& Juanita & Celso.worked- then();
Tashonda sent e-mail.
(TOP (S (NP (NNP Tashonda)) (VP (VBD sent) (NP (NN e-mail))) (. .)))
Tashonda.sent-(E-mail);
Tashonda sent cards and letters.
(TOP (S (NP (NNP Tashonda)) (VP (VBD sent) (NP (NNS cards) (CC and) (NNS letters))) (. .)))
Tashonda.sent-(Letters*);
Tashonda sent e-mail, cards, and letters.
(TOP (S (NP (NNP Tashonda)) (VP (VBD sent) (NP (NN e-mail) (, ,) (NNS cards) (, ,) (CC and) (NNS letters))) (. .)))
Tashonda.sent-(Letters*);
Tashonda sent e-mail, cards, or letters.
(TOP (S (NP (NNP Tashonda)) (VP (VBD sent) (NP (NN e-mail) (, ,) (NNS cards) (, ,) (CC or) (NNS letters))) (. .)))
Tashonda.sent-(Letters*);
Mrs.
(TOP (NNP Mrs.))
Doubtfire gave the children homework.
(TOP (S (NP (NNP Doubtfire)) (VP (VBD gave) (NP (DT the) (NNS children) (NN homework))) (. .)))
Doubtfire.gave-(Homework*);
Mrs.
(TOP (NNP Mrs.))
Doubtfire gave Tabitha and Samantha quizzes.
(TOP (S (NP (NNP Doubtfire)) (VP (VBD gave) (NP (NNP Tabitha) (CC and) (NNP Samantha) (NNS quizzes))) (. .)))
Doubtfire.gave-(Quizzes*);
I myself prefer basketball.
(TOP (S (NP (NP (PRP I)) (NP (PRP myself))) (VP (VBP prefer) (NP (NN basketball))) (. .)))
& I & Myself.prefer(Basketball);
I prefer basketball myself.
(TOP (S (NP (PRP I)) (VP (VBP prefer) (NP (NN basketball)) (NP (PRP myself))) (. .)))
I.prefer(Myself);
John Calhoun is a coach.
(TOP (S (NP (NNP John) (NNP Calhoun)) (VP (VBZ is) (NP (DT a) (NN coach))) (. .)))
Calhoun.is(Coach);
Johnny painted his old jalopy purple.
(TOP (S (NP (NNP Johnny)) (VP (VBD painted) (NP (PRP$ his) (JJ old) (NN jalopy) (NN purple))) (. .)))
Johnny.painted-(Purple old);
The club elected Tashonda president.
(TOP (S (NP (DT The) (NN club)) (VP (VBD elected) (NP (NNP Tashonda) (NN president))) (. .)))
Club.elected-(President);
The club elected Tashonda as its president.
(TOP (S (NP (DT The) (NN club)) (VP (VBD elected) (NP (NNP Tashonda)) (PP (IN as) (NP (PRP$ its) (NN president)))) (. .)))
Club.elected- as[President](Tashonda);
Man, that hurt! Athletic moves excite the crowd.
(TOP (S (NP (NP (NP (NN Man)) (, ,) (SBAR (WHNP (WDT that)) (S (VP (VBP hurt))))) (. !) (NP (NNP Athletic))) (VP (VBZ moves) (VP (VB excite) (NP (DT the) (NN crowd)))) (. .)))
& Man & Athletic.moves(excite(Crowd));
The little old lady hit the tall and distinguished gentleman.
(TOP (S (NP (DT The) (JJ little) (JJ old) (NN lady)) (VP (VBD hit) (NP (DT the) (JJ tall) (CC and) (JJ distinguished) (NN gentleman))) (. .)))
Lady little old.hit-(Gentleman tall distinguished);
Samson was powerful.
(TOP (S (NP (NNP Samson)) (VP (VBD was) (ADJP (JJ powerful))) (. .)))
Samson.was-(powerful);
Dogsbreath works quickly.
(TOP (S (NP (NNP Dogsbreath)) (VP (VBZ works) (ADVP (RB quickly))) (. .)))
Dogsbreath.works quickly();
Dr.
(TOP (NNP Dr.))
Turveydrop waited patiently and quietly at the door.
(TOP (S (NP (NNP Turveydrop)) (VP (VBD waited) (ADVP (RB patiently) (CC and) (RB quietly)) (PP (IN at) (NP (DT the) (NN door)))) (. .)))
Turveydrop.waited- quietly at[Door]();
Charles is working in the garden.
(TOP (S (NP (NNP Charles)) (VP (VBZ is) (VP (VBG working) (PP (IN in) (NP (DT the) (NN garden))))) (. .)))
Charles.is(working in[Garden]());
Charles is working in the garden by the river.
(TOP (S (NP (NNP Charles)) (VP (VBZ is) (VP (VBG working) (PP (IN in) (NP (DT the) (NN garden))) (PP (IN by) (NP (DT the) (NN river))))) (. .)))
Charles.is(working in[Garden] by[River]());
She felt under the weather.
(TOP (S (NP (PRP She)) (VP (VBD felt) (PP (IN under) (NP (DT the) (NN weather)))) (. .)))
She.felt- under[Weather]();
The screaming crowd watched the bridge falling into the river.
(TOP (S (NP (DT The) (VBG screaming) (NN crowd)) (VP (VBD watched) (S (NP (DT the) (NN bridge)) (VP (VBG falling) (PP (IN into) (NP (DT the) (NN river)))))) (. .)))
Crowd.watched-();
The New Yorker quickly rejected whatever Sarah submitted.
(TOP (S (NP (DT The) (JJ New) (NNP Yorker)) (ADVP (RB quickly)) (VP (VBD rejected) (SBAR (IN whatever) (S (NP (NNP Sarah)) (VP (VBD submitted))))) (. .)))
Yorker new.rejected-();
When the train goes through, the windows rattle noisily and the whole house shakes.
(TOP (S (SBAR (WHADVP (WRB When)) (S (NP (DT the) (NN train)) (VP (VBZ goes) (ADVP (RP through))))) (, ,) (NP (DT the) (NNS windows) (NN rattle)) (ADVP (RB noisily)) (CC and) (S (NP (DT the) (JJ whole) (NN house)) (VP (VBZ shakes))) (. .)))