JRowe Posted March 12, 2010 Share Posted March 12, 2010 I've been experimenting with Link Grammar for several weeks. It's somewhat akin to a reverse regular expression. You input a regular English (or German or Italian) sentence, and it outputs a pattern parsed from the structure of the sentence. The Link Grammar Parser is a syntactic parser of English, based on link grammar, an original theory of English syntax. Given a sentence, the system assigns to it a syntactic structure, which consists of a set of labeled links connecting pairs of words. The parser also produces a "constituent" representation of a sentence (showing noun phrases, verb phrases, etc.). This is used in a grammar checker for a word processor, various NLP software, and is also one of the core NLP components of OpenCog. For those of you I've lost, this is what it actually does. Give Link Grammar a sentence like: "My dog likes dog food." It outputs: +------------------Xp-----------------+ +----Wd----+ +------Ou------+ | | +-Ds+--Ss--+ +---AN--+ | | | | | | | | LEFT-WALL my dog.n likes.v dog.n food.n-u . Or, even better, it chunks the input into phrases, similar to the way your english teacher had you do in school: (S (NP My dog) (VP likes (NP dog food)) .) Even better, Link Grammar can take words it's unsure of and make educated guesses about the grammatical structure. Let's invent a word, like foofsnarfle. foofsnarfle is a verb that means "to throw a cow at a rapidly moving target." My input sentence is "My brother foofsnarfled a truck." The result is correct; Link Grammar determines that foofsnarfle is a verb and generates the proper diagram. (S (NP My brother) (VP foofsnarfled (NP a truck)) .) LG can also output PostScript format, along with a 2D list of word - type pairs, like so: My.f Ds+ dog.n Wd- Ds- Ss+ likes.v Ss- Ou+ dog.n AN+ food.s Ou- AN- . Xp- The latest news and documentation can be found on this page: http://www.abisource.com/projects/link-grammar/ This is the documentation of the English dictionary, and what the symbols mean: http://www.abisource.com/projects/link-grammar/dict/index.html This is the API documentation, which contains all the functions I have wrapped: http://www.abisource.com/projects/link-grammar/api/index.html There are two additional functions that aren't documented, required for different output. Those are: Func _LG_LinkagePrintDisjuncts($hLinkage) $result = DllCall($_LG_DLL, "str:cdecl", "linkage_print_disjuncts", "ptr", $hLinkage) Return $result[0] EndFunc This function provides the list of word <-> type pairs. The other function is : Func _LG_LinkagePrintConstituentTree($hLinkage, $iOpt) ;char * linkage_print_constituent_tree(Linkage linkage int iOpt); $result = DllCall($_LG_DLL, "str:cdecl", "linkage_print_constituent_tree", "ptr", $hLinkage, "int", $iOpt) Return $result[0] EndFunc ;==>_LG_LinkagePrintConstituentTree This outputs the parsed phrase format, explained here: http://www.link.cs.cmu.edu/link/ph-explanation.html Here's the sample code to get you going: #include "_LinkGrammar.au3" $Test = "My dog likes dog food." $options = _LG_ParseOptionsCreate() $dict = _LG_DictionaryCreateLang("en") $Sentence = _LG_SentenceCreate($Test, $dict) _LG_SentenceSplit($Sentence, $options) $num_linkages = _LG_SentenceParse($Sentence, $options) If $num_linkages > 0 Then $linkage = _LG_LinkageCreate(0, $Sentence, $options) $diagram = _LG_LinkagePrintDiagram($linkage) $diagram2 = _LG_LinkagePrintConstituentTree($linkage, 3) $diagram3 = _LG_LinkagePrintDisjuncts($linkage) ConsoleWrite($diagram & @CRLF) ConsoleWrite($diagram2 & @CRLF) ConsoleWrite($diagram3 & @CRLF) EndIf And finally: Here's the AutoIt packge, with the dll, the English, and the German dictionaries: http://www.AutoIt.me/_LinkGrammar_au3.zip Enjoy! jvanegmond 1 [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
wraithdu Posted March 13, 2010 Share Posted March 13, 2010 Let's invent a word, like foofsnarfle. foofsnarfle is a verb that means "to throw a cow at a rapidly moving target."I think a sentence like this says so much about a person. This is the kind of thing that would be in the prison psychologist's file after you've gone all Hannibal Lecter. Link to comment Share on other sites More sharing options...
JRowe Posted March 13, 2010 Author Share Posted March 13, 2010 Let's play word association! "Foofsnarfle" "Arghniblewonk" "MurderStabKill!" Yay, I want to do Rorschach blots now! [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Erion Posted January 27, 2012 Share Posted January 27, 2012 Hello, I've tried to download the linked file, however the link is no longer valid. Could someone post a working link please? Much thanks, Erion Link to comment Share on other sites More sharing options...
ldub Posted January 27, 2012 Share Posted January 27, 2012 It lacks in the autoit package : dll, English, and German dictionaries. Thanks Link to comment Share on other sites More sharing options...
HAMID Posted January 29, 2012 Share Posted January 29, 2012 hi JRowe download link not work MiniFinder Link to comment Share on other sites More sharing options...
DJKMan Posted March 30, 2012 Share Posted March 30, 2012 I'm glad I kept an archive of most of the things I found interesting!_LinkGrammar_au3.zip mLipok 1 Link to comment Share on other sites More sharing options...
nlta1992 Posted March 13, 2017 Share Posted March 13, 2017 I don't dowload file link-grammar.dll , JRowe check link , thanks. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 13, 2017 Moderators Share Posted March 13, 2017 @nlta1992 first off, the thread is over 7 years old, and the OP has not been active in more than two; pretty unlikely you would get a response. Secondly, if you'd read the post directly above your own, you'd see DJKMan provided a zip file containing everything you need. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
nlta1992 Posted March 13, 2017 Share Posted March 13, 2017 ok thanks JLogan3o13 , I''l contact DJKMan Link to comment Share on other sites More sharing options...
mLipok Posted October 18, 2018 Share Posted October 18, 2018 Added to wiki: https://www.autoitscript.com/wiki/User_Defined_Functions#Misc UDF updated in attachment. LinkGrammar_au3.zip Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now