English to babel-lang
Recently I was checking up on some AI possibilities and found out about babel-lang, which seems to be an interesti开发者_如何学运维ng concept.
The project appears to be abandoned but the concept is quite interesting. It offers a babel > english translator and a good spec to do so, but no way to do the oposite.
I was wondering how one could go about making an english > babel translator.
From what I can think of, the only way is to have a large set of verbs, nouns, adjectives, etc which can then be used translate the sentence into babel.
Is this really the only (or best) way?
Babel is my little project. It's correct that there hasn't been any work done to the project in a long time. I still hope to pick it up again though.
An english->babel translator would be awesome and I would love to see such a project. But the difficulty of the problem is the entirety of Natural Language Processing. In theory an NLP parsing engine could be modified to output babel.
The whole point of the babel project is to "divide the problem" cleanly. By having the user write what they really mean (aka babel code), then we don't have to worry about the NLP problems and can instead focus on the real problem of creating and manipulating thoughts.
Bryan
So I've actually started to make an English to Babel translator and it's going fairly well. I've only spent a few hours on it and it works perfectly for a third of my test example sentences already.
I've taken the (SharpNLP port of the) OpenNLP parser which produces a Penn Treebank formatted parse of the english sentences, which I then walk to create Babel.
It's now available at http://translator.babelproject.com/EnglishToBabel.aspx Go ahead and give it a try.
The first line will be an echo of the english sentence. The second is the parse tree that is generated by OpenNLP, and finally the third line of each output is the generated Babel.
It's all built in C#. Let me know if you'd like the source to it.
The SharpNLP parser kind of sucks and it's getting some bad parses in the example sentences. Apparently it's a port of an old version of OpenNLP. I'm probably going to switch to the Stanford parser which seems to give much better parse results. The state of the art for parser accuracy seems to be about 90%.
Here's an example of the current output from it. I'm working on hooking it up to an interactive fiction game engine. :)
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))) (. .)))
精彩评论