เวอร์ชัน 5.12.5
ตัวแยกวิเคราะห์ไวยากรณ์ลิงก์จัดแสดงโครงสร้างภาษา (ภาษาธรรมชาติ) ของภาษาอังกฤษ, ไทย, รัสเซีย, อาหรับ, เปอร์เซียและชุดย่อยที่ จำกัด ของภาษาอื่น ๆ ครึ่งโหล โครงสร้างนี้เป็นกราฟของลิงก์ที่พิมพ์ (ขอบ) ระหว่างคำในประโยค หนึ่งอาจได้รับ HPSG ทั่วไป (ส่วนประกอบ) และการพึ่งพาสไตล์การพึ่งพาจากไวยากรณ์ลิงก์โดยใช้ชุดของกฎเพื่อแปลงเป็นรูปแบบที่แตกต่างกันเหล่านี้ สิ่งนี้เป็นไปได้เพราะลิงก์ไวยากรณ์ไปเล็กน้อย "ลึก" ในโครงสร้าง "syntactico-semantic" ของประโยค: มันให้ข้อมูลที่ละเอียดและละเอียดมากกว่าที่มีอยู่ทั่วไปใน parsers ทั่วไป
ทฤษฎีการแยกวิเคราะห์ไวยากรณ์ของลิงค์ได้รับการพัฒนาในปี 1991 โดย Davy Temperley, John Lafferty และ Daniel Sleator ในเวลานั้นอาจารย์สอนภาษาศาสตร์และวิทยาศาสตร์คอมพิวเตอร์ที่มหาวิทยาลัย Carnegie Mellon สิ่งพิมพ์เริ่มต้นทั้งสามเกี่ยวกับทฤษฎีนี้ให้การแนะนำและภาพรวมที่ดีที่สุด ตั้งแต่นั้นมามีสิ่งพิมพ์หลายร้อยฉบับสำรวจตรวจสอบและขยายความคิดเพิ่มเติม
แม้ว่าจะขึ้นอยู่กับฐานรหัส Carnegie-Mellon ดั้งเดิมแพ็คเกจลิงค์ไวยากรณ์ปัจจุบันมีการพัฒนาอย่างมากและแตกต่างอย่างลึกซึ้งจากรุ่นก่อนหน้า มีการแก้ไขข้อผิดพลาดนับไม่ถ้วน ประสิทธิภาพได้รับการปรับปรุงตามคำสั่งซื้อหลายระดับ แพ็คเกจนี้เปิดใช้งานแบบมัลติเธรดเต็มรูปแบบ UTF-8 อย่างสมบูรณ์และได้รับการขัดถูเพื่อความปลอดภัยเปิดใช้งานการปรับใช้คลาวด์ ความครอบคลุมของการแยกวิเคราะห์ภาษาอังกฤษได้รับการปรับปรุงอย่างมาก มีการเพิ่มภาษาอื่น ๆ (โดยเฉพาะอย่างยิ่งไทยและรัสเซีย) มีคุณสมบัติใหม่มากมายรวมถึงการรองรับสัณฐานวิทยาภาษาถิ่นและระบบน้ำหนัก (ราคา) ที่ดีช่วยให้พฤติกรรมเหมือนการฝังตัวของเวกเตอร์ มีโทเคนิเซอร์ใหม่ที่มีความซับซ้อนซึ่งเหมาะสำหรับสัณฐานวิทยา: มันสามารถเสนอการแยกทางเลือกสำหรับคำที่คลุมเครือทางสัณฐานวิทยา พจนานุกรมสามารถอัปเดตได้ในเวลาทำงานทำให้ระบบที่ดำเนินการเรียนรู้ไวยากรณ์อย่างต่อเนื่องเพื่อแยกวิเคราะห์ในเวลาเดียวกัน นั่นคือการอัปเดตพจนานุกรมและการแยกวิเคราะห์เป็นแบบเธรดที่ปลอดภัยร่วมกัน คลาสของคำสามารถรับรู้ด้วย regexes รองรับการแยกกราฟกราฟแบบแบบสุ่มได้รับการสนับสนุนอย่างเต็มที่ สิ่งนี้จะช่วยให้การสุ่มตัวอย่างแบบสม่ำเสมอของพื้นที่ของกราฟระนาบ รายงานโดยละเอียดเกี่ยวกับสิ่งที่เปลี่ยนแปลงสามารถพบได้ในการเปลี่ยนแปลง
รหัสนี้เปิดตัวภายใต้ใบอนุญาต LGPL ทำให้สามารถใช้งานได้อย่างอิสระสำหรับการใช้งานส่วนตัวและเชิงพาณิชย์โดยมีข้อ จำกัด เล็กน้อย ข้อกำหนดของใบอนุญาตจะได้รับในไฟล์ใบอนุญาตที่รวมอยู่ในซอฟต์แวร์นี้
โปรดดูหน้าเว็บหลักสำหรับข้อมูลเพิ่มเติม รุ่นนี้เป็นความต่อเนื่องของตัวแยกวิเคราะห์ CMU ดั้งเดิม
ณ รุ่น 5.9.0 ระบบรวมระบบทดลองสำหรับการสร้างประโยค สิ่งเหล่านี้ถูกระบุโดยใช้ "เติมในช่องว่าง" API ซึ่งคำจะถูกแทนที่ในตำแหน่งการ์ดไวด์เมื่อใดก็ตามที่ผลลัพธ์เป็นประโยคที่ถูกต้องทางไวยากรณ์ รายละเอียดเพิ่มเติมอยู่ในหน้า Man: man link-generator (ในไดเรกทอรีย่อย man )
เครื่องกำเนิดไฟฟ้านี้ใช้ในโครงการการเรียนรู้ภาษา OpenCog ซึ่งมีจุดมุ่งหมายเพื่อเรียนรู้ไวยากรณ์เชื่อมโยงจาก Corpora โดยอัตโนมัติโดยใช้เทคนิคทางทฤษฎีข้อมูลใหม่และนวัตกรรมซึ่งค่อนข้างคล้ายกับที่พบในอวนประสาทเทียม (การเรียนรู้ลึก) แต่ใช้การเป็นตัวแทนเชิงสัญลักษณ์อย่างชัดเจน
ตัวแยกวิเคราะห์รวมถึง API ในภาษาการเขียนโปรแกรมที่แตกต่างกันรวมถึงเครื่องมือบรรทัดคำสั่งที่มีประโยชน์สำหรับการเล่นกับมัน นี่คือผลลัพธ์ทั่วไปบางอย่าง:
linkparser> This is a test!
Linkage 1, cost vector = (UNUSED=0 DIS= 0.00 LEN=6)
+-------------Xp------------+
+----->WV----->+---Ost--+ |
+---Wd---+-Ss*b+ +Ds**c+ |
| | | | | |
LEFT-WALL this.p is.v a test.n !
(S (NP this.p) (VP is.v (NP a test.n)) !)
LEFT-WALL 0.000 Wd+ hWV+ Xp+
this.p 0.000 Wd- Ss*b+
is.v 0.000 Ss- dWV- O*t+
a 0.000 Ds**c+
test.n 0.000 Ds**c- Os-
! 0.000 Xp- RW+
RIGHT-WALL 0.000 RW-
จอแสดงผลที่ค่อนข้างยุ่งนี้แสดงให้เห็นถึงสิ่งที่น่าสนใจมากมาย ตัวอย่างเช่นลิงก์ Ss*b เชื่อมต่อคำกริยาและหัวเรื่องและระบุว่าตัวแบบเป็นเอกพจน์ ในทำนองเดียวกันลิงก์ Ost เชื่อมต่อคำกริยาและวัตถุและยังระบุว่าวัตถุนั้นเป็นเอกพจน์ จุดเชื่อมโยง WV (Verb-Wall) ที่จุดกริยาหัวของประโยคในขณะที่ลิงก์ Wd จะชี้ไปที่คำนามคำนาม ลิงก์ Xp เชื่อมต่อกับเครื่องหมายวรรคตอนต่อท้าย ลิงก์ Ds**c เชื่อมต่อคำนามกับตัวกำหนด: มันยืนยันอีกครั้งว่าคำนามเป็นเอกพจน์และคำนามเริ่มต้นด้วยพยัญชนะ (ไม่จำเป็นต้องใช้ลิงก์ PH ที่นี่เพื่อบังคับให้เกิดข้อตกลงการออกเสียงแยกแยะ 'A' จาก 'an') ประเภทลิงค์เหล่านี้มีการบันทึกไว้ในเอกสารลิงค์ภาษาอังกฤษ
ด้านล่างของจอแสดงผลเป็นรายการของ "disjuncts" ที่ใช้สำหรับแต่ละคำ disjuncts เป็นเพียงรายการของตัวเชื่อมต่อที่ใช้เพื่อสร้างลิงก์ พวกเขาน่าสนใจเป็นพิเศษเพราะพวกเขาทำหน้าที่เป็นรูปแบบที่ละเอียดมากของ "ส่วนหนึ่งของคำพูด" ตัวอย่างเช่น: disjunct S- O+ หมายถึงคำกริยาสกรรมกริยา: มันเป็นคำกริยาที่ใช้ทั้งเรื่องและวัตถุ มาร์กอัปเพิ่มเติมข้างต้นบ่งชี้ว่า 'IS' ไม่เพียง แต่ถูกใช้เป็นคำกริยาสกรรมกริยา แต่ยังบ่งบอกถึงรายละเอียดที่ละเอียดยิ่งขึ้น: คำกริยาสกรรมกริยาที่ใช้หัวเรื่องเอกพจน์และใช้ (ใช้เป็น) คำกริยาหัวของประโยค ค่าจุดลอยตัวคือ "ต้นทุน" ของการแยกออก มันจับความคิดเกี่ยวกับความสามารถในการบันทึกของการใช้ไวยากรณ์นี้โดยเฉพาะ ส่วนของคำพูดที่มีความสัมพันธ์กับการใช้คำพูดดังนั้นส่วนที่ละเอียดของการพูดก็มีความสัมพันธ์กับความแตกต่างที่ดีขึ้นและการไล่ระดับสีของความหมาย
ตัวแยกวิเคราะห์ลิงค์ไวยากรณ์ยังสนับสนุนการวิเคราะห์ทางสัณฐานวิทยา นี่คือตัวอย่างในภาษารัสเซีย:
linkparser> это теста
Linkage 1, cost vector = (UNUSED=0 DIS= 0.00 LEN=4)
+-----MVAip-----+
+---Wd---+ +-LLCAG-+
| | | |
LEFT-WALL это.msi тест.= =а.ndnpi
ลิงค์ LL เชื่อมต่อลำต้น 'тест' กับคำต่อท้าย 'а' ลิงค์ MVA เชื่อมต่อกับคำต่อท้ายเท่านั้นเพราะในรัสเซียมันเป็นคำต่อท้ายที่มีโครงสร้างทางไวยากรณ์ทั้งหมดไม่ใช่ลำต้น Lexis รัสเซียมีการบันทึกไว้ที่นี่
พจนานุกรมไทยได้รับการพัฒนาอย่างเต็มที่ครอบคลุมทั้งภาษาอย่างมีประสิทธิภาพ ตัวอย่างในภาษาไทย:
linkparser> นายกรัฐมนตรี ขึ้น กล่าว สุนทรพจน์
Linkage 1, cost vector = (UNUSED=0 DIS= 2.00 LEN=2)
+---------LWs--------+
| +<---S<--+--VS-+-->O-->+
| | | | |
LEFT-WALL นายกรัฐมนตรี.n ขึ้น.v กล่าว.v สุนทรพจน์.n
ลิงก์ VS เชื่อมต่อคำกริยาสองคำ 'ขึ้น' และ 'กล่าว' ในการก่อสร้างคำกริยาอนุกรม สรุปประเภทลิงก์มีการบันทึกไว้ที่นี่ เอกสารฉบับเต็มของไวยากรณ์ไทยลิงค์สามารถพบได้ที่นี่
ไวยากรณ์ของไทยลิงค์ยังยอมรับอินพุตที่ติดแท็กและมีชื่อติดแท็กชื่อ แต่ละคำสามารถใส่คำอธิบายประกอบด้วยแท็ก POS ลิงค์ ตัวอย่างเช่น:
linkparser> เมื่อวานนี้.n มี.ve คน.n มา.x ติดต่อ.v คุณ.pr ครับ.pt
Found 1 linkage (1 had no P.P. violations)
Unique linkage, cost vector = (UNUSED=0 DIS= 0.00 LEN=12)
+---------------------PT--------------------+
+---------LWs---------+---------->VE---------->+ |
| +<---S<---+-->O-->+ +<--AXw<-+--->O--->+ |
| | | | | | | |
LEFT-WALL เมื่อวานนี้.n[!] มี.ve[!] คน.n[!] มา.x[!] ติดต่อ.v[!] คุณ.pr[!] ครับ.pt[!]
เอกสารฉบับเต็มสำหรับพจนานุกรมไทยสามารถพบได้ที่นี่
พจนานุกรมไทยยอมรับ TAGSETS LST20 สำหรับ POS และเอนทิตีที่มีชื่อเพื่อเชื่อมช่องว่างระหว่างเครื่องมือ NLP พื้นฐานและตัวแยกวิเคราะห์ลิงก์ ตัวอย่างเช่น:
linkparser> linkparser> วันที่_25_ธันวาคม@DTM ของ@PS ทุก@AJ ปี@NN เป็น@VV วัน@NN คริสต์มาส@NN
Found 348 linkages (348 had no P.P. violations)
Linkage 1, cost vector = (UNUSED=0 DIS= 1.00 LEN=10)
+--------------------------------LWs--------------------------------+
| +<------------------------S<------------------------+
| | +---------->PO--------->+ |
| +----->AJpr----->+ +<---AJj<--+ +---->O---->+------NZ-----+
| | | | | | | |
LEFT-WALL วันที่_25_ธันวาคม@DTM[!] ของ@PS[!].pnn ทุก@AJ[!].jl ปี@NN[!].n เป็น@VV[!].v วัน@NN[!].na คริสต์มาส@NN[!].n
โปรดทราบว่าแต่ละคำด้านบนมีคำอธิบายประกอบด้วยแท็ก LST20 POS และแท็ก NE เอกสารเต็มรูปแบบสำหรับทั้งแท็ก POS ลิงค์และแท็ก LST20 สามารถพบได้ที่นี่ ข้อมูลเพิ่มเติมเกี่ยวกับ LST20 เช่นแนวทางคำอธิบายประกอบและสถิติข้อมูลสามารถพบได้ที่นี่
ภาษา any รองรับกราฟระนาบแบบสุ่มแบบสุ่มอย่างสม่ำเสมอ:
linkparser> asdf qwer tyuiop fghj bbb
Found 1162 linkages (1162 had no P.P. violations)
+-------ANY------+-------ANY------+
+---ANY--+--ANY--+ +---ANY--+--ANY--+
| | | | | |
LEFT-WALL asdf[!] qwer[!] tyuiop[!] fghj[!] bbb[!]
ภาษา ady ก็ทำเช่นเดียวกันโดยทำการแยกทางสัณฐานวิทยาแบบสุ่ม:
linkparser> asdf qwerty fghjbbb
Found 1512 linkages (1512 had no P.P. violations)
+------------------ANY-----------------+
+-----ANY----+-------ANY------+ +---------LL--------+
| | | | |
LEFT-WALL asdf[!ANY-WORD] qwerty[!ANY-WORD] fgh[!SIMPLE-STEM].= =jbbb[!SIMPLE-SUFF]
ภาพรวมและบทสรุปที่ขยายออกไปสามารถพบได้ในหน้าลิงค์ไวยากรณ์วิกิพีเดียซึ่งสัมผัสกับการนำเข้าส่วนใหญ่ด้านหลักของทฤษฎี อย่างไรก็ตามมันไม่ได้ทดแทนเอกสารต้นฉบับที่เผยแพร่ในหัวข้อ:
มีเอกสารและการอ้างอิงอีกมากมายที่ระบุไว้ในเว็บไซต์ไวยากรณ์ลิงค์หลัก
ดูเอกสาร C/C ++ API ด้วย การผูกสำหรับภาษาการเขียนโปรแกรมอื่น ๆ รวมถึง Python3, java และ node.js สามารถพบได้ในไดเรกทอรีการผูก (มีการเชื่อม JavaScript สองชุด: ชุดหนึ่งชุดสำหรับ Library API และชุดอื่นสำหรับตัวแยกวิเคราะห์บรรทัดคำสั่ง)
| เนื้อหา | คำอธิบาย |
|---|---|
| ใบอนุญาต | ใบอนุญาตอธิบายข้อกำหนดการใช้งาน |
| การเปลี่ยนแปลง | บทสรุปของการเปลี่ยนแปลงล่าสุด |
| กำหนดค่า | สคริปต์การกำหนดค่า GNU |
| autogen.sh | เครื่องมือบำรุงรักษากำหนดค่าของนักพัฒนา |
| ลิงก์ไวยากรณ์/*. c | โปรแกรม (เขียนใน ansi-c) |
| - | - |
| การผูก/autoit/ | การผูกมัดภาษาอัตโนมัติเสริม |
| การผูก/java/ | การผูกภาษา Java เสริม |
| การผูก/js/ | การผูกภาษา JavaScript ทางเลือก |
| การผูก/lisp/ | การผูกมัดภาษา Lisp ทั่วไปทางเลือก |
| bindings/node.js/ | การผูกมัดภาษา Node.js เป็นตัวเลือก |
| การผูก/ocaml/ | การผูกมัดภาษา OCAML เป็นทางเลือก |
| การผูก/Python/ | การผูกภาษา Python3 เสริม |
| การผูก/Python-Examples/ | ชุดทดสอบ Link-Grammar และภาษา Python ที่มีผลผูกพันการใช้งาน |
| การผูก/swig/ | ไฟล์อินเตอร์เฟส Swig สำหรับอินเทอร์เฟซ FFI อื่น ๆ |
| การผูก/vala/ | การผูกมัดภาษา Vala เป็นทางเลือก |
| - | - |
| ข้อมูล/en/ | พจนานุกรมภาษาอังกฤษ |
| ข้อมูล/en/4.0.dict | ไฟล์ที่มีคำจำกัดความพจนานุกรม |
| ข้อมูล/en/4.0.knowledge | ไฟล์ความรู้หลังการประมวลผล |
| data/en/4.0.constituents | ไฟล์ความรู้ที่เป็นส่วนประกอบ |
| ข้อมูล/en/4.0.affix | ไฟล์ affix (คำนำหน้า/คำต่อท้าย) |
| data/en/4.0.regex | การคาดเดาทางสัณฐานวิทยาตามการแสดงออกเป็นประจำ |
| data/en/tiny.dict | พจนานุกรมตัวอย่างเล็ก ๆ |
| ข้อมูล/en/words/ | ไดเรกทอรีที่เต็มไปด้วยรายการคำ |
| data/en/corpus*. -batch | ตัวอย่าง Corpora ใช้สำหรับการทดสอบ |
| - | - |
| ข้อมูล/ru/ | พจนานุกรมรัสเซียเต็มเปี่ยม |
| ข้อมูล/th/ | พจนานุกรมไทยที่เต็มเปี่ยม (100,000+ คำ) |
| ข้อมูล/AR/ | พจนานุกรมภาษาอาหรับที่ค่อนข้างสมบูรณ์ |
| ข้อมูล/FA/ | พจนานุกรมเปอร์เซีย (Farsi) |
| ข้อมูล/de/ | พจนานุกรมต้นแบบขนาดเล็กภาษาเยอรมัน |
| ข้อมูล/lt/ | พจนานุกรม Lithuanian ต้นแบบขนาดเล็ก |
| ข้อมูล/id/ | พจนานุกรมต้นแบบชาวอินโดนีเซียขนาดเล็ก |
| ข้อมูล/vn/ | พจนานุกรมต้นแบบเวียดนามขนาดเล็ก |
| ข้อมูล/เขา/ | พจนานุกรมฮีบรูทดลอง |
| ข้อมูล/kz/ | พจนานุกรมคาซัคห์ทดลอง |
| ข้อมูล/tr/ | พจนานุกรมการทดลองตุรกี |
| - | - |
| สัณฐานวิทยา/AR/ | เครื่องวิเคราะห์สัณฐานวิทยาอาหรับ |
| สัณฐานวิทยา/FA/ | เครื่องวิเคราะห์สัณฐานวิทยาเปอร์เซีย |
| - | - |
| ดีบัก/ | ข้อมูลเกี่ยวกับการดีบักห้องสมุด |
| MSVC/ | ไฟล์โครงการ Microsoft Visual-C |
| Mingw/ | ข้อมูลเกี่ยวกับการใช้ MingW ภายใต้ MSYS หรือ Cygwin |
ระบบกระจายโดยใช้รูปแบบ tar.gz ทั่วไป สามารถสกัดได้โดยใช้คำสั่ง tar -zxf link-grammar.tar.gz ที่บรรทัดคำสั่ง
Tarball ของเวอร์ชันล่าสุดสามารถดาวน์โหลดได้จาก:
https://www.gnucash.org/link-grammar/downloads/
ไฟล์ได้รับการลงนามแบบดิจิทัลเพื่อให้แน่ใจว่าไม่มีการทุจริตของชุดข้อมูลในระหว่างการดาวน์โหลดและเพื่อช่วยให้แน่ใจว่าไม่มีการเปลี่ยนแปลงที่เป็นอันตรายต่อรหัสภายในของบุคคลที่สาม ลายเซ็นสามารถตรวจสอบได้ด้วยคำสั่ง GPG:
gpg --verify link-grammar-5.12.5.tar.gz.asc
ซึ่งควรสร้างผลลัพธ์เหมือนกับ (ยกเว้นวันที่):
gpg: Signature made Thu 26 Apr 2012 12:45:31 PM CDT using RSA key ID E0C0651C
gpg: Good signature from "Linas Vepstas (Hexagon Architecture Patches) <[email protected]>"
gpg: aka "Linas Vepstas (LKML) <[email protected]>"
อีกวิธีหนึ่งสามารถตรวจสอบการตรวจสอบ MD5 ได้ สิ่งเหล่านี้ไม่ได้ให้ความปลอดภัยในการเข้ารหัส แต่พวกเขาสามารถตรวจจับการทุจริตอย่างง่าย ในการตรวจสอบเช็คซัมให้ออก md5sum -c MD5SUM ที่บรรทัดคำสั่ง
แท็กใน git สามารถตรวจสอบได้โดยทำสิ่งต่อไปนี้:
gpg --recv-keys --keyserver keyserver.ubuntu.com EB6AA534E0C0651C
git tag -v link-grammar-5.10.5
ในการรวบรวมไลบรารีและโปรแกรมการสาธิตที่แชร์ไวยากรณ์ลิงก์ไวยากรณ์ที่บรรทัดคำสั่งพิมพ์:
./configure
make
make check
ในการติดตั้งให้เปลี่ยนผู้ใช้เป็น "รูท" และพูด
make install
ldconfig
สิ่งนี้จะติดตั้งไลบรารี liblink-grammar.so ลงใน /usr/local/lib ไฟล์ส่วนหัวใน /usr/local/include/link-grammar และพจนานุกรมลงใน /usr/local/share/link-grammar Running ldconfig จะสร้างแคชไลบรารีที่ใช้ร่วมกันใหม่ เพื่อตรวจสอบว่าการติดตั้งนั้นสำเร็จให้รัน (เป็นผู้ใช้ที่ไม่ใช่รูท)
make installcheck
ไลบรารีลิงก์ไวยากรณ์มีคุณสมบัติเสริมที่เปิดใช้งานโดยอัตโนมัติหาก configure ตรวจจับไลบรารีบางอย่าง ไลบรารีเหล่านี้เป็นทางเลือกในระบบส่วนใหญ่และหากคุณลักษณะที่เพิ่มเข้ามานั้นต้องการไลบรารีที่สอดคล้องกันจะต้องติดตั้งก่อนที่จะเรียกใช้ configure
ชื่อแพ็คเกจไลบรารีอาจแตกต่างกันไปในระบบต่าง ๆ (ปรึกษา Google หากจำเป็น ... ) ตัวอย่างเช่นชื่ออาจรวมถึง -devel แทน -dev หรือโดยไม่ต้องใช้งานทั้งหมด ชื่อไลบรารีอาจไม่มีคำนำหน้า lib
libsqlite3-dev (สำหรับพจนานุกรม sqlite-backed)libz1g-dev หรือ libz-devel (ปัจจุบันจำเป็นสำหรับ minisat2 ที่รวมกัน)libedit-dev (ดู editline)libhunspell-dev หรือ libaspell-dev (และพจนานุกรมภาษาอังกฤษที่สอดคล้องกัน)libtre-dev หรือ libpcre2-dev (เร็วกว่าการใช้ Libc Regex มากและจำเป็นสำหรับความถูกต้องใน FreeBSD และ Cygwin)libpcre2-dev อย่างยิ่ง จะต้องใช้กับระบบบางอย่าง (ตามที่ระบุไว้ในส่วนอาคาร) หากติดตั้ง libedit-dev แล้วปุ่มลูกศรสามารถใช้ในการแก้ไขอินพุตไปยังเครื่องมือลิงก์ Parser; ปุ่มลูกศรขึ้นและลงจะเรียกคืนรายการก่อนหน้านี้ คุณต้องการสิ่งนี้; มันทำให้การทดสอบและการแก้ไขง่ายขึ้นมาก
รวมถึงการผูก Node.js สองรุ่น เวอร์ชันหนึ่งห่อห้องสมุด อื่น ๆ ใช้ emscripten เพื่อห่อเครื่องมือบรรทัดคำสั่ง การผูกไลบรารีอยู่ใน bindings/node.js ในขณะที่ wrapper emscripten อยู่ใน bindings/js
สิ่งเหล่านี้ถูกสร้างขึ้นโดยใช้ npm ก่อนอื่นคุณต้องสร้างห้องสมุด C Core C จากนั้นทำสิ่งต่อไปนี้:
cd bindings/node.js
npm install
npm run make
สิ่งนี้จะสร้างการผูกไลบรารีและเรียกใช้การทดสอบหน่วยขนาดเล็ก (ซึ่งควรผ่าน) ตัวอย่างสามารถพบได้ใน bindings/node.js/examples/simple.js
สำหรับ wrapper บรรทัดคำสั่งให้ทำสิ่งต่อไปนี้:
cd bindings/js
./install_emsdk.sh
./build_packages.sh
การผูก Python3 ถูกสร้างขึ้นโดยค่าเริ่มต้นโดยมีการติดตั้งแพ็คเกจการพัฒนา Python ที่สอดคล้องกัน (ไม่รองรับการผูก Python2 อีกต่อไป)
แพ็คเกจเหล่านี้คือ:
python3-develpython3-dev หมายเหตุ: ก่อนที่จะออก configure (ดูด้านล่าง) คุณต้องตรวจสอบว่าสามารถเรียกใช้เวอร์ชัน Python ที่ต้องการได้โดยใช้ PATH ของคุณ
การใช้การผูก python เป็น ทางเลือก ; คุณไม่ต้องการสิ่งเหล่านี้หากคุณไม่ได้วางแผนที่จะใช้ลิงก์ไวยากรณ์กับ Python หากคุณต้องการปิดใช้งานการผูก python ให้ใช้:
./configure --disable-python-bindings
โมดูล linkgrammar.py ให้อินเทอร์เฟซระดับสูงใน Python example.py และ sentence-check.py scripts ให้การสาธิตและ tests.py การทดสอบหน่วยการรัน
make install pythondir=/where/to/install โดยค่าเริ่มต้นความพยายามของ Makefile ในการสร้างการผูก Java การใช้การผูก Java เป็น ทางเลือก คุณไม่ต้องการสิ่งเหล่านี้หากคุณไม่ได้วางแผนที่จะใช้ลิงก์ไวยากรณ์กับ Java คุณสามารถข้ามการสร้างการผูก Java โดยปิดการใช้งานดังนี้:
./configure --disable-java-bindings
หากไม่พบ jni.h หรือไม่พบ ant แล้วการผูก Java จะไม่ถูกสร้างขึ้น
หมายเหตุเกี่ยวกับการค้นหา jni.h :
การแจกแจง Java JVM ทั่วไปบางส่วน (โดยเฉพาะอย่างยิ่งชื่อจาก Sun) วางไฟล์นี้ในตำแหน่งที่ผิดปกติซึ่งไม่สามารถพบได้โดยอัตโนมัติ ในการแก้ไขปัญหานี้ตรวจสอบให้แน่ใจว่าตั้งค่าตัวแปรสภาพแวดล้อม JAVA_HOME อย่างถูกต้อง สคริปต์การกำหนดค่าค้นหา jni.h ใน $JAVA_HOME/Headers และใน $JAVA_HOME/include ; นอกจากนี้ยังตรวจสอบตำแหน่งที่สอดคล้องกันสำหรับ $JDK_HOME หากไม่พบ jni.h ให้ระบุตำแหน่งด้วยตัวแปร CPPFLAGS : ดังนั้นตัวอย่างเช่นตัวอย่างเช่น
export CPPFLAGS="-I/opt/jdk1.5/include/:/opt/jdk1.5/include/linux"
หรือ
export CPPFLAGS="-I/c/java/jdk1.6.0/include/ -I/c/java/jdk1.6.0/include/win32/"
โปรดทราบว่าการใช้ /opt นั้นไม่ได้มาตรฐานและเครื่องมือระบบส่วนใหญ่จะไม่สามารถค้นหาแพ็คเกจที่ติดตั้งได้
เป้าหมายการติดตั้ง /usr/local สามารถใช้งานได้มากเกินไปโดยใช้ตัวเลือก configure --prefix ; ตัวอย่างเช่น:
./configure --prefix=/opt/link-grammar
ด้วยการใช้ pkg-config (ดูด้านล่าง) สามารถตรวจพบตำแหน่งการติดตั้งที่ไม่ได้มาตรฐานโดยอัตโนมัติ
ตัวเลือกการกำหนดค่าเพิ่มเติมถูกพิมพ์โดย
./configure --help
ระบบได้รับการทดสอบและทำงานได้ดีในระบบ Linux 32 และ 64 บิต, FreeBSD, MACOS รวมถึง Microsoft Windows Systems บันทึกที่ขึ้นอยู่กับระบบปฏิบัติการเฉพาะตาม
ผู้ใช้ปลายทางควรดาวน์โหลด tarball (ดูการแกะและการตรวจสอบลายเซ็น)
รุ่น GitHub ปัจจุบันมีไว้สำหรับนักพัฒนา (รวมถึงทุกคนที่เต็มใจให้การแก้ไขคุณลักษณะใหม่หรือการปรับปรุง) ส่วนปลายของสาขาหลักมักไม่เสถียรและบางครั้งอาจมีรหัสที่ไม่ดีในนั้นเนื่องจากอยู่ระหว่างการพัฒนา นอกจากนี้ยังต้องการการติดตั้งเครื่องมือพัฒนาที่ไม่ได้ติดตั้งโดยค่าเริ่มต้น เนื่องจากเหตุผลเหล่านี้การใช้เวอร์ชัน GitHub จึงถูกท้อแท้สำหรับผู้ใช้ทั่วไป
โคลนไอที: git clone https://github.com/opencog/link-grammar.git
หรือดาวน์โหลดเป็นซิป:
https://github.com/opencog/link-grammar/archive/master.zip
เครื่องมือที่อาจต้องติดตั้งก่อนที่คุณจะสามารถสร้างไวยากรณ์ลิงค์:
make (อาจจำเป็นต้องใช้ตัวแปร gmake )
m4
gcc หรือ clang
autoconf
libtool
autoconf-archive
pkg-config (อาจมีชื่อว่า pkgconf หรือ pkgconfig )
pip3 (สำหรับการผูก python)
ไม่จำเป็น:
swig (สำหรับการผูกภาษา)
flex
Apache Ant (สำหรับการผูก Java)
graphviz (หากคุณต้องการใช้คุณสมบัติการแสดงผลคำ-กราฟ)
เวอร์ชัน GitHub ไม่รวมสคริปต์ configure เพื่อสร้างให้ใช้:
autogen.sh
หากคุณได้รับข้อผิดพลาดตรวจสอบให้แน่ใจว่าคุณได้ติดตั้งแพ็คเกจการพัฒนาที่ระบุไว้ข้างต้นและการติดตั้งระบบของคุณเป็นข้อมูลล่าสุด โดยเฉพาะอย่างยิ่ง autoconf หรือ autoconf-archive อาจทำให้เกิดข้อผิดพลาดที่แปลกและทำให้เข้าใจผิด
สำหรับข้อมูลเพิ่มเติมเกี่ยวกับวิธีดำเนินการต่อให้ดำเนินการต่อในส่วนการสร้างระบบและส่วนที่เกี่ยวข้องหลังจากนั้น
ในการกำหนดค่าโหมด การดีบัก ให้ใช้:
configure --enable-debug
มันเพิ่มรหัสการดีบักการตรวจสอบและฟังก์ชั่นที่สามารถพิมพ์โครงสร้างข้อมูลได้หลายอย่าง
คุณสมบัติที่อาจเป็นประโยชน์สำหรับการดีบักคือการแสดงคำกราฟ มันถูกเปิดใช้งานโดยค่าเริ่มต้น สำหรับรายละเอียดเพิ่มเติมเกี่ยวกับคุณสมบัตินี้ให้ดูที่การแสดงผลคำกราฟ
การกำหนดค่าปัจจุบันมีปัญหาการผสมไลบรารี C ++ มาตรฐานที่ชัดเจนเมื่อใช้ gcc (ยินดีต้อนรับการแก้ไข) อย่างไรก็ตามการปฏิบัติทั่วไปของ FreeBSD คือการรวบรวมด้วย clang และไม่มีปัญหานี้ นอกจากนี้แพ็คเกจ Add-on ยังติดตั้งภายใต้ /usr/local
ดังนั้นนี่คือวิธี configure ควรเรียกใช้:
env LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include
CC=clang CXX=clang++ configure
โปรดทราบว่า pcre2 เป็นแพ็คเกจที่จำเป็นเนื่องจากการใช้งาน libc Regex ที่มีอยู่ไม่มีระดับการสนับสนุน Regex ที่จำเป็น
บางแพ็คเกจมีชื่อแตกต่างจากชื่อที่กล่าวถึงในส่วนก่อนหน้า:
minisat (minisat2) pkgconf (pkg-config)
ไวยากรณ์ลิงค์ Plain-Vanilla ควรรวบรวมและทำงานบน Apple MacOS ได้ดีตามที่อธิบายไว้ข้างต้น ในเวลานี้ไม่มีปัญหารายงาน
หากคุณไม่ต้องการการผูก Java คุณควรกำหนดค่าอย่างแน่นอนด้วย:
./configure --disable-java-bindings
หากคุณต้องการการผูก Java ให้แน่ใจว่าได้ตั้งค่าตัวแปรสภาพแวดล้อม jdk_home เป็นที่ใดก็ตามที่ <Headers/jni.h> คือ ตั้งค่าตัวแปร Java_home เป็นตำแหน่งของคอมไพเลอร์ Java ตรวจสอบให้แน่ใจว่าคุณติดตั้งมดแล้ว
หากคุณต้องการสร้างจาก GitHub (ดูอาคารจากที่เก็บ GitHub) คุณสามารถติดตั้งเครื่องมือที่อยู่ในรายการโดยใช้ Homebrew
มีสามวิธีที่สามารถรวบรวมไวยากรณ์ลิงค์ได้บน Windows วิธีหนึ่งคือการใช้ Cygwin ซึ่งมีเลเยอร์ความเข้ากันได้ของ Linux สำหรับ Windows อีกวิธีหนึ่งคือใช้ระบบ MSVC วิธีที่สามคือการใช้ระบบ MingW ซึ่งใช้ชุดเครื่องมือ GNU เพื่อรวบรวมโปรแกรม Windows ซอร์สโค้ดรองรับระบบ Windows จาก Vista On
Cygwin Way ในปัจจุบันให้ผลลัพธ์ที่ดีที่สุดเนื่องจากรองรับการแก้ไขบรรทัดด้วยการเสร็จสิ้นคำสั่งและประวัติและยังรองรับคำกราฟที่แสดงบน X-Windows (ปัจจุบัน Mingw ไม่มี libedit และปัจจุบันพอร์ต MSVC ไม่รองรับการเสร็จสิ้นคำสั่งและประวัติและการสะกดคำ
วิธีที่ง่ายที่สุดในการให้ไวยากรณ์ลิงก์ทำงานบน MS Windows คือการใช้ Cygwin ซึ่งเป็นสภาพแวดล้อมที่มีลักษณะคล้าย Linux สำหรับ Windows ทำให้ซอฟต์แวร์พอร์ตทำงานบนระบบ POSIX ไปยัง Windows ดาวน์โหลดและติดตั้ง Cygwin
โปรดทราบว่าจำเป็นต้องมีการติดตั้งแพ็คเกจ pcre2 เนื่องจากการใช้งาน LIBC Regex นั้นไม่สามารถทำได้เพียงพอ
สำหรับรายละเอียดเพิ่มเติมโปรดดู MINGW/Readme-Cygwin.md
อีกวิธีหนึ่งในการสร้างไวยากรณ์ลิงก์คือการใช้ MINGW ซึ่งใช้ชุดเครื่องมือ GNU เพื่อรวบรวมโปรแกรมที่สอดคล้องกับ POSIX สำหรับ Windows การใช้ MINGW/MSYS2 อาจเป็นวิธีที่ง่ายที่สุดในการรับการผูก Java ที่ใช้งานได้สำหรับ Windows ดาวน์โหลดและติดตั้ง MINGW/MSYS2 จาก MSYS2.org
โปรดทราบว่าจำเป็นต้องมีการติดตั้งแพ็คเกจ pcre2 เนื่องจากการใช้งาน LIBC Regex นั้นไม่สามารถทำได้เพียงพอ
สำหรับรายละเอียดเพิ่มเติมโปรดดู MINGW/README-MINGW64.MD
ไฟล์โครงการ Microsoft Visual C/C ++ สามารถพบได้ในไดเรกทอรี msvc สำหรับเส้นทางดูไฟล์ readme.md ที่นั่น
ในการเรียกใช้ปัญหาโปรแกรมคำสั่ง (สมมติว่าอยู่ในเส้นทางของคุณ):
link-parser [arguments]
สิ่งนี้เริ่มโปรแกรม โปรแกรมมีตัวแปรและตัวเลือกที่ผู้ใช้สามารถตั้งถิ่นฐานได้มากมาย สิ่งเหล่านี้สามารถแสดงได้โดยป้อน !var ที่พรอมต์ลิงก์-Parser การป้อน !help จะแสดงคำสั่งเพิ่มเติม
พจนานุกรมถูกจัดเรียงในไดเรกทอรีที่มีชื่อเป็นรหัสภาษา 2 ตัวอักษร โปรแกรม Link-Parser ค้นหาไดเรกทอรีภาษาดังกล่าวในลำดับนั้นโดยตรงหรือภายใต้ data ชื่อไดเรกทอรี:
/usr/local/share/link-grammar )หาก Link-Parser ไม่สามารถหาพจนานุกรมที่ต้องการให้ใช้ Verbosity Level 4 เพื่อแก้ไขปัญหา ตัวอย่างเช่น:
link-parser ru -verbosity=4
สามารถระบุตำแหน่งอื่น ๆ บนบรรทัดคำสั่ง; ตัวอย่างเช่น:
link-parser ../path/to-my/modified/data/en
เมื่อเข้าถึงพจนานุกรมในตำแหน่งที่ไม่ได้มาตรฐานชื่อไฟล์มาตรฐานจะยังคงสันนิษฐาน ( เช่น 4.0.dict , 4.0.affix ฯลฯ )
พจนานุกรมรัสเซียอยู่ใน data/ru ดังนั้นตัวแยกวิเคราะห์ของรัสเซียสามารถเริ่มต้นเป็น:
link-parser ru
หากคุณไม่ได้จัดหาอาร์กิวเมนต์ให้กับ Link-Parser มันจะค้นหาภาษาตามการตั้งค่าสถานที่ปัจจุบันของคุณ หากไม่สามารถหาไดเรกทอรีภาษาดังกล่าวได้ก็จะเริ่มต้นเป็น "EN"
หากคุณเห็นข้อผิดพลาดคล้ายกับสิ่งนี้:
Warning: The word "encyclop" found near line 252 of en/4.0.dict
matches the following words:
encyclop
This word will be ignored.
จากนั้นสถานที่ UTF-8 ของคุณไม่ได้ติดตั้งหรือไม่ได้กำหนดค่า locale -a ควรแสดงรายการ en_US.utf8 เป็นสถานที่ ถ้าไม่เช่นนั้นคุณจะต้องใช้ dpkg-reconfigure locales และ/หรือเรียกใช้การ update-locale หรืออาจเป็นไป apt-get install locales หรือชุดค่าผสมหรือตัวแปรเหล่านี้ขึ้นอยู่กับระบบปฏิบัติการของคุณ
มีหลายวิธีในการทดสอบการสร้างที่เกิดขึ้น หากการเชื่อมโยง Python ถูกสร้างขึ้นโปรแกรมทดสอบสามารถพบได้ในไฟล์ ./bindings/python-examples/tests.py เมื่อรันมันควรผ่าน สำหรับรายละเอียดเพิ่มเติมโปรดดู readme.md ในไดเรกทอรี bindings/python-examples
นอกจากนี้ยังมีประโยคทดสอบ/ตัวอย่างหลายชุดในไดเรกทอรีข้อมูลภาษาโดยทั่วไปมีชื่อ corpus-*.batch โปรแกรม Parser สามารถเรียกใช้ในโหมดแบทช์สำหรับการทดสอบระบบด้วยประโยคจำนวนมาก คำสั่งต่อไปนี้เรียกใช้ตัวแยกวิเคราะห์ในไฟล์ที่เรียกว่า corpus-basic.batch ;
link-parser < corpus-basic.batch
บรรทัด !batch ใกล้กับด้านบนของ corpus-basic.batch เปิดโหมดแบทช์ ในโหมดนี้ควรมีการปฏิเสธประโยคที่มีการเริ่มต้น * และผู้ที่ไม่ได้เริ่มต้นด้วย A * ควรได้รับการยอมรับ ไฟล์แบตช์นี้รายงานข้อผิดพลาดบางอย่างเช่นเดียวกับไฟล์ corpus-biolg.batch และ corpus-fixes.batch งานยังดำเนินการเพื่อแก้ไขปัญหาเหล่านี้
ไฟล์ corpus-fixes.batch มีประโยคหลายพันประโยคที่ได้รับการแก้ไขตั้งแต่การเปิดตัว Link-Grammar ดั้งเดิม 4.1 corpus-biolg.batch มีประโยคชีววิทยา/ข้อความทางการแพทย์จากโครงการ Biolg corpus-voa.batch มีตัวอย่างจาก Voice of America; corpus-failures.batch มีความล้มเหลวจำนวนมาก
ตัวเลขต่อไปนี้อาจมีการเปลี่ยนแปลง แต่ในเวลานี้จำนวนข้อผิดพลาดที่คาดว่าจะสังเกตได้ในแต่ละไฟล์เหล่านี้มีดังนี้:
en/corpus-basic.batch: 88 errors
en/corpus-fixes.batch: 371 errors
lt/corpus-basic.batch: 15 errors
ru/corpus-basic.batch: 47 errors
ไดเรกทอรีการผูก/Python มีการทดสอบหน่วยสำหรับการผูก python นอกจากนี้ยังทำการตรวจสอบพื้นฐานหลายประการที่เน้นไลบรารีลิงก์ไวยากรณ์
มี API (อินเทอร์เฟซโปรแกรมแอปพลิเคชัน) ไปยังตัวแยกวิเคราะห์ สิ่งนี้ทำให้ง่ายต่อการรวมไว้ในแอปพลิเคชันของคุณเอง API ได้รับการบันทึกไว้ในเว็บไซต์
ไฟล์ FindLinkGrammar.cmake สามารถใช้เพื่อทดสอบและตั้งค่าการรวบรวมในสภาพแวดล้อมการสร้างที่ใช้ CMake
เพื่อให้การรวบรวมและการเชื่อมโยงง่ายขึ้นรีลีสปัจจุบันใช้ระบบ PKG-Config ในการกำหนดตำแหน่งของไฟล์ส่วนหัวของลิงค์ไวยากรณ์ให้พูดว่า pkg-config --cflags link-grammar เพื่อให้ได้ตำแหน่งของไลบรารีกล่าวว่า pkg-config --libs link-grammar ดังนั้นตัวอย่างเช่น makefile ทั่วไปอาจรวมถึงเป้าหมาย:
.c.o:
cc -O2 -g -Wall -c $< `pkg-config --cflags link-grammar`
$(EXE): $(OBJS)
cc -g -o $@ $^ `pkg-config --libs link-grammar`
รุ่นนี้มีไฟล์ Java ที่เสนอสามวิธีในการเข้าถึงตัวแยกวิเคราะห์ วิธีที่ง่ายที่สุดคือการใช้คลาส org.linkgrammar.linkgrammar; นี่เป็น Java API ที่ง่ายมากสำหรับตัวแยกวิเคราะห์
ความเป็นไปได้ที่สองคือการใช้คลาส LGService สิ่งนี้ใช้เซิร์ฟเวอร์เครือข่าย TCP/IP ซึ่งให้ผลลัพธ์ที่แยกวิเคราะห์เป็นข้อความ JSON ไคลเอนต์ที่มีความสามารถ JSON ใด ๆ สามารถเชื่อมต่อกับเซิร์ฟเวอร์นี้และรับข้อความที่แยกวิเคราะห์ได้
ความเป็นไปได้ที่สามคือการใช้คลาส org.linkgrammar.lgremoteclient และโดยเฉพาะอย่างยิ่งวิธีการแยกวิเคราะห์ () คลาสนี้เป็นไคลเอนต์เครือข่ายที่เชื่อมต่อกับเซิร์ฟเวอร์ JSON และแปลงการตอบกลับกลับเป็นผลลัพธ์ที่สามารถเข้าถึงได้ผ่าน Parseresult API
รหัสที่อธิบายข้างต้นจะถูกสร้างขึ้นหากติดตั้ง Apache ant
เซิร์ฟเวอร์เครือข่ายสามารถเริ่มต้นได้โดยพูดว่า:
java -classpath linkgrammar.jar org.linkgrammar.LGService 9000
ด้านบนเริ่มต้นเซิร์ฟเวอร์บนพอร์ต 9000 มันถูกละเว้นพอร์ตข้อความวิธีใช้จะถูกพิมพ์ เซิร์ฟเวอร์นี้สามารถติดต่อได้โดยตรงผ่าน TCP/IP; ตัวอย่างเช่น:
telnet localhost 9000
(อีกวิธีหนึ่งใช้ NetCat แทน Telnet) หลังจากเชื่อมต่อพิมพ์ใน:
text: this is an example sentence to parse
ไบต์ที่ส่งคืนจะเป็นข้อความ JSON ที่ให้การแยกของประโยค โดยค่าเริ่มต้นการแยกวิเคราะห์ ASCII-ART ของข้อความจะไม่ถูกส่ง สามารถรับได้โดยการส่งข้อความของแบบฟอร์ม:
storeDiagramString:true, text: this is a test.
ตัวแยกวิเคราะห์จะเรียกใช้ตัวตรวจสอบคาถาในระยะแรกหากพบคำที่ไม่ทราบและไม่สามารถคาดเดาได้ตามสัณฐานวิทยา สคริปต์การกำหนดค่าค้นหา Aspell หรือ Hunspell checkers; หากพบสภาพแวดล้อมการพัฒนา Aspell แล้ว Aspell จะถูกใช้งาน Hunspell จะถูกใช้
การคาดเดาการสะกดคำอาจถูกปิดใช้งานเมื่อรันไทม์ในไคลเอนต์ลิงก์-Parser ด้วย !spell=0 Flag ป้อน !help สำหรับรายละเอียดเพิ่มเติม
ข้อควรระวัง: ASPELL เวอร์ชัน 0.60.8 และคนอื่น ๆ อาจมีการรั่วไหลของหน่วยความจำ การใช้การสะกดคำในเซิร์ฟเวอร์การผลิตนั้นไม่สนับสนุนอย่างยิ่ง การปิดใช้งานการสะกดคำ ( =0 ) ใน Parse_Options นั้นปลอดภัย
มันปลอดภัยที่จะใช้ไวยากรณ์ลิงก์ในหลายเธรด เธรดอาจใช้พจนานุกรมเดียวกัน ตัวเลือกการแยกวิเคราะห์สามารถตั้งค่าได้ตามแบบต่อเธรดยกเว้น Verbosity ซึ่งเป็นทั่วโลกซึ่งใช้ร่วมกันโดยเธรดทั้งหมด มันเป็นระดับโลกเท่านั้น
A/A/AN DEMINISE ก่อนการพยัญชนะ/เสียงสระจะได้รับการจัดการโดยประเภทลิงค์ pH ใหม่เชื่อมโยงตัวกำหนดกับคำทันทีต่อไปนี้ สถานะ: แนะนำในเวอร์ชัน 5.1.0 (สิงหาคม 2014) ส่วนใหญ่ทำแม้ว่าคำนามกรณีพิเศษจำนวนมากจะยังไม่เสร็จ
การเชื่อมโยงทิศทางเป็นสิ่งจำเป็นสำหรับบางภาษาเช่นภาษาลิทัวเนียตุรกีและภาษาคำสั่งซื้อฟรีอื่น ๆ เป้าหมายคือการมีลิงก์อย่างชัดเจนระบุว่าคำใดคือคำหัวและสิ่งที่ขึ้นอยู่กับ นี่คือความสำเร็จโดยตัวเชื่อมต่อคำนำหน้าด้วยตัวอักษร ตัวพิมพ์ เล็กเดียว: H, D, ระบุ 'หัว' และ 'ขึ้นอยู่กับ' กฎการเชื่อมโยงนั้นเป็นสิ่งที่ H ตรงกับไม่มีอะไรหรือ D และ D ตรงกับ H หรือไม่มีอะไรเลย นี่เป็นคุณสมบัติใหม่ในเวอร์ชัน 5.1.0 (สิงหาคม 2014) เว็บไซต์จัดทำเอกสารเพิ่มเติม
แม้ว่าลิงก์ไวยากรณ์ภาษาอังกฤษภาษาอังกฤษจะไม่มุ่งเน้น แต่ดูเหมือนว่าทิศทางของความเป็นจริงสามารถมอบให้กับพวกเขาที่สอดคล้องกับแนวคิดมาตรฐานของไวยากรณ์การพึ่งพาอาศัยกันอย่างสมบูรณ์
ลูกศรพึ่งพามีคุณสมบัติดังต่อไปนี้:
Anti-reflexive (คำไม่สามารถพึ่งพาตัวเองได้มันไม่สามารถชี้ไปที่ตัวเองได้)
Antimmetric (ถ้า Word1 ขึ้นอยู่กับ Word2 ดังนั้น Word2 ไม่สามารถขึ้นอยู่กับ Word1) (เช่นตัวกำหนดค่าขึ้นอยู่กับคำนาม แต่ไม่เคยในทางกลับกัน)
ลูกศรไม่ได้เป็นสกรรมกริยาหรือต่อต้าน transitive: คำเดียวอาจถูกปกครองโดยหลายหัว ตัวอย่างเช่น:
+------>WV------->+
+-->Wd-->+<--Ss<--+
| | |
LEFT-WALL she thinks.v
นั่นคือมีเส้นทางไปสู่เรื่อง "เธอ" โดยตรงจากกำแพงด้านซ้ายผ่านลิงก์ WD รวมถึงทางอ้อมจากผนังไปจนถึงกริยารากและจากนั้นไปที่เรื่อง รูปแบบลูปที่คล้ายกันกับลิงก์ B และ R ลูปดังกล่าวมีประโยชน์สำหรับการ จำกัด จำนวนการแยกวิเคราะห์ที่เป็นไปได้: ข้อ จำกัด เกิดขึ้นร่วมกับ "ไม่มีลิงก์ข้าม" เมตารีกฎ
มีแนวคิดทางคณิตศาสตร์ที่เกี่ยวข้องหลายประการ แต่ไม่มีการจับภาพ LG ทิศทางที่ค่อนข้าง:
กราฟ LG Directional มีลักษณะคล้ายกับ DAG ยกเว้นว่า LG อนุญาตให้มีเพียงผนังเดียว (หนึ่งองค์ประกอบ "ด้านบน")
กราฟ LG Directional มีลักษณะคล้ายกับคำสั่งซื้อบางส่วนที่เข้มงวดยกเว้นว่าลูกศร LG มักจะไม่ถ่ายภาพ
กราฟ LG Directional มีลักษณะคล้ายกับ catena ยกเว้นว่า catena นั้นต่อต้านการแปลอย่างเคร่งครัด-เส้นทางไปสู่คำใด ๆ นั้นไม่เหมือนใครใน catena
เอกสารพื้นฐาน LG ได้รับคำสั่งให้เกิดระนาบของกราฟแยกวิเคราะห์ สิ่งนี้ขึ้นอยู่กับการสังเกตที่เก่าแก่มากว่าการพึ่งพานั้นแทบจะไม่เคยข้ามในภาษาธรรมชาติ: มนุษย์ไม่ได้พูดในประโยคที่เชื่อมโยงข้าม ข้อ จำกัด ของ planarity ที่กำหนดนั้นให้ข้อ จำกัด ด้านวิศวกรรมและอัลกอริทึมที่แข็งแกร่งเกี่ยวกับการแยกวิเคราะห์ที่เกิดขึ้น: จำนวนการแยกวิเคราะห์ทั้งหมดที่จะพิจารณาจะลดลงอย่างรวดเร็วและความเร็วโดยรวมของการแยกวิเคราะห์สามารถเพิ่มขึ้นได้อย่างมาก
อย่างไรก็ตามมีข้อยกเว้นที่ค่อนข้างหายากสำหรับกฎระนาบนี้เป็นครั้งคราว ข้อยกเว้นดังกล่าวพบได้ในเกือบทุกภาษา มีข้อยกเว้นเหล่านี้จำนวนหนึ่งสำหรับภาษาอังกฤษด้านล่าง
ดังนั้นจึงเป็นเรื่องสำคัญที่จะต้องผ่อนคลายข้อ จำกัด ของระนาบและค้นหาสิ่งอื่นที่เกือบจะเข้มงวด แต่ก็ยังอนุญาตให้มีข้อยกเว้นไม่บ่อยนัก มันจะปรากฏว่าแนวคิดของ "การเปลี่ยนแปลงสถานที่สำคัญ" ตามที่ริชาร์ดฮัดสันกำหนดไว้ในทฤษฎีของเขาเกี่ยวกับ "คำไวยากรณ์คำ" ของเขาจากนั้นก็สนับสนุนโดยเบ็นโกร์ทเซลอาจเป็นกลไกดังกล่าว
ftp://ftp.phon.ucl.ac.uk/pub/word-grammar/ell2-wg.pdf
http://www.phon.ucl.ac.uk/home/dick/enc/syntax.htm
http://goertzel.org/prowlgrammar.pdf
ในทางปฏิบัติข้อ จำกัด ของ Planarity ช่วยให้อัลกอริทึมที่มีประสิทธิภาพมากสามารถใช้ในการดำเนินการของตัวแยกวิเคราะห์ ดังนั้นจากมุมมองของการดำเนินการเราต้องการรักษาความน่าสนใจ โชคดีที่มีวิธีที่สะดวกและไม่คลุมเครือในการมีเค้กของเราและกินมันเช่นกัน ไดอะแกรมที่ไม่ใช่แผนการสามารถวาดบนแผ่นกระดาษโดยใช้สัญลักษณ์วิศวกรรมไฟฟ้ามาตรฐาน: สัญลักษณ์ตลก ๆ สัญกรณ์นี้ปรับให้เข้ากับตัวเชื่อมต่อ LG ได้ง่ายมาก ด้านล่างเป็นตัวอย่างการทำงานที่เกิดขึ้นจริงได้นำไปใช้ในพจนานุกรม LG ภาษาอังกฤษปัจจุบันแล้ว การข้ามลิงค์ ทั้งหมด สามารถนำไปใช้ในวิธีนี้! ดังนั้นเราไม่จำเป็นต้องละทิ้งอัลกอริทึมการแยกวิเคราะห์ในปัจจุบันเพื่อรับไดอะแกรมที่ไม่ใช่แผนการ เราไม่จำเป็นต้องแก้ไขด้วยซ้ำ! ไชโย
นี่คือตัวอย่างการทำงาน: "ฉันต้องการดูและฟังทุกอย่าง" สิ่งนี้ต้องการลิงก์ J สองลิงก์ชี้ไปที่ 'ทุกอย่าง' แผนภาพที่ต้องการจะต้องมีลักษณะเช่นนี้:
+---->WV---->+
| +--------IV---------->+
| | +<-VJlpi--+
| | | +---xxx------------Js------->+
+--Wd--+-Sp*i+--TO-+-I*t-+-MVp+ +--VJrpi>+--MVp-+---Js->+
| | | | | | | | | |
LEFT-WALL I.p want.v to.r look.v at and.j-v listen.v to.r everything
ข้างต้นต้องการมีลิงก์ Js จาก 'at' ถึง 'ทุกอย่าง' แต่ลิงก์ Js นี้ข้าม (ปะทะกับ - ทำเครื่องหมายโดย xxx) ลิงก์ไปยังการรวมกัน ตัวอย่างอื่น ๆ ชี้ให้เห็นว่าเราควรอนุญาตให้ลิงก์ส่วนใหญ่ข้ามข้ามลิงก์ไปยังการเชื่อม
การทำงานที่ได้รับการดูแลเป็นระยะ ๆ คือการแบ่งลิงก์ Js ออกเป็นสอง: ส่วน Jj และส่วน Jk ; ทั้งสองใช้ร่วมกันเพื่อข้ามการรวมกัน ปัจจุบันมีการใช้งานในพจนานุกรมภาษาอังกฤษและใช้งานได้
การทำงานรอบนี้เป็นความจริงทั่วไปอย่างสมบูรณ์และสามารถขยายไปยังการข้ามลิงค์ใด ๆ สำหรับสิ่งนี้ในการทำงานสัญกรณ์ที่ดีกว่าจะสะดวก perhaps uJs- instead of Jj- and vJs- instead of Jk- , or something like that ... (TODO: invent better notation.) (NB: This is a kind of re-invention of "fat links", but in the dictionary, not in the code.)
Given that non-planar parses can be enabled without any changes to the parser algorithm, all that is required is to understand what sort of theory describes link-crossing in a coherent grounding. That theory is Dick Hudson's Landmark Transitivity, explained here.
This mechanism works as follows:
First, every link must be directional, with a head and a dependent. That is, we are concerned with directional-LG links, which are of the form x--A-->y or y<--A--x for words x,y and LG link type A.
Given either the directional-LG relation x--A-->y or y<--A--x, define the dependency relation x-->y. That is, ignore the link-type label.
Heads are landmarks for dependents. If the dependency relation x-->y holds, then x is said to be a landmark for y, and the predicate land(x,y) is true, while the predicate land(y,x) is false. Here, x and y are words, while --> is the landmark relation.
Although the basic directional-LG links form landmark relations, the total set of landmark relations is extended by transitive closure. That is, if land(x,y) and land(y,z) then land(x,z). That is, the basic directional-LG links are "generators" of landmarks; they generate by means of transitivity. Note that the transitive closure is unique.
In addition to the above landmark relation, there are two additional relations: the before and after landmark relations. (In English, these correspond to left and right; in Hebrew, the opposite). That is, since words come in chronological order in a sentence, the dependency relation can point either left or right. The previously-defined landmark relation only described the dependency order; we now introduce the word-sequence order. Thus, there are are land-before() and land-after() relations that capture both the dependency relation, and the word-order relation.
Notation: the before-landmark relation land-B(x,y) corresponds to x-->y (in English, reversed in right-left languages such as Hebrew), whereas the after-landmark relation land-A(x,y) corresponds to y<--x. That is, land(x,y) == land-B(x,y) or land-A(x,y) holds as a statement about the predicate form of the relations.
As before, the full set of directional landmarks are obtained by transitive closure applied to the directional-LG links. Two different rules are used to perform this closure:
-- land-B(x,y) and land(y,z) ==> land-B(x,y)
-- land-A(x,y) and land(y,z) ==> land-A(x,y)
Parsing is then performed by joining LG connectors in the usual manner, to form a directional link. The transitive closure of the directional landmarks are then computed. Finally, any parse that does not conclude with the "left wall" being the upper-most landmark is discarded.
Here is an example where landmark transitivity provides a natural solution to a (currently) broken parse. The "to.r" has a disjunct "I+ & MVi-" which allows "What is there to do?" to parse correctly. However, it also allows the incorrect parse "He is going to do". The fix would be to force "do" to take an object; however, a link from "do" to "what" is not allowed, because link-crossing would prevent it.
Fixing this requires only a fix to the dictionary, and not to the parser itself.
Examples where the no-links-cross constraint seems to be violated, in English:
"He is either in the 105th or the 106th battalion."
"He is in either the 105th or the 106th battalion."
Both seem to be acceptable in English, but the ambiguity of the "in-either" temporal ordering requires two different parse trees, if the no-links-cross rule is to be enforced. This seems un-natural. Similarly:
"He is either here or he is there."
"He either is here or he is there."
A different example involves a crossing to the left wall. That is, the links LEFT-WALL--remains crosses over here--found :
"Here the remains can be found."
Other examples, per And Rosta:
The allowed--by link crosses cake--that :
He had been allowed to eat a cake by Sophy that she had made him specially
a--book , very--indeed
"a very much easier book indeed"
an--book , easy--to
"an easy book to read"
a--book , more--than
"a more difficult book than that one"
that--have crosses remains--of
"It was announced that remains have been found of the ark of the covenant"
There is a natural crossing, driven by conjunctions:
"I was in hell yesterday and heaven on Tuesday."
the "natural" linkage is to use MV links to connect "yesterday" and "on Tuesday" to the verb. However, if this is done, then these must cross the links from the conjunction "and" to "heaven" and "hell". This can be worked around partly as follows:
+-------->Ju--------->+
| +<------SJlp<----+
+<-SX<-+->Pp->+ +-->Mpn->+ +->SJru->+->Mp->+->Js->+
| | | | | | | | |
I was in hell yesterday and heaven on Tuesday
but the desired MV links from the verb to the time-prepositions "yesterday" and "on Tuesday" are missing -- whereas they are present, when the individual sentences "I was in hell yesterday" and "I was in heaven on Tuesday" are parsed. Using a conjunction should not wreck the relations that get used; but this requires link-crossing.
"Sophy wondered up to whose favorite number she should count"
Here, "up_to" must modify "number", and not "whose". There's no way to do this without link-crossing.
Link Grammar can be understood in the context of type theory. A simple introduction to type theory can be found in chapter 1 of the HoTT book. This book is freely available online and strongly recommended if you are interested in types.
Link types can be mapped to types that appear in categorial grammars. The nice thing about link-grammar is that the link types form a type system that is much easier to use and comprehend than that of categorial grammar, and yet can be directly converted to that system! That is, link-grammar is completely compatible with categorial grammar, and is easier-to-use. See the paper "Combinatory Categorial Grammar and Link Grammar are Equivalent" for details.
The foundational LG papers make comments to this effect; however, see also work by Bob Coecke on category theory and grammar. Coecke's diagrammatic approach is essentially identical to the diagrams given in the foundational LG papers; it becomes abundantly clear that the category theoretic approach is equivalent to Link Grammar. See, for example, this introductory sketch http://www.cs.ox.ac.uk/people/bob.coecke/NewScientist.pdf and observe how the diagrams are essentially identical to the LG jigsaw-puzzle piece diagrams of the foundational LG publications.
If you have any questions, please feel free to send a note to the mailing list.
The source code of link-parser and the link-grammar library is located at GitHub.
For bug reports, please open an issue there.
Although all messages should go to the mailing list, the current maintainers can be contacted at:
Linas Vepstas - <[email protected]>
Amir Plivatsky - <[email protected]>
Dom Lachowicz - <[email protected]>
A complete list of authors and copyright holders can be found in the AUTHORS file. The original authors of the Link Grammar parser are:
Daniel Sleator [email protected]
Computer Science Department 412-268-7563
Carnegie Mellon University www.cs.cmu.edu/~sleator
Pittsburgh, PA 15213
Davy Temperley [email protected]
Eastman School of Music 716-274-1557
26 Gibbs St. www.link.cs.cmu.edu/temperley
Rochester, NY 14604
John Lafferty [email protected]
Computer Science Department 412-268-6791
Carnegie Mellon University www.cs.cmu.edu/~lafferty
Pittsburgh, PA 15213
Some working notes.
Easy to fix: provide a more uniform API to the constituent tree. ie provide word index. Also, provide a better word API, showing word extent, subscript, etc.
There are subtle technical issues for handling capitalized first words. This needs to be fixed. In addition, for now these words are shown uncapitalized in the result linkages. This can be fixed.
Maybe capitalization could be handled in the same way that a/an could be handled! After all, it's essentially a nearest-neighbor phenomenon!
See also issue 690
The proximal issue is to add a cost, so that Bill gets a lower cost than bill.n when parsing "Bill went on a walk". The best solution would be to add a 'capitalization-mark token' during tokenization; this token precedes capitalized words. The dictionary then explicitly links to this token, with rules similar to the a/an phonetic distinction. The point here is that this moves capitalization out of ad-hoc C code and into the dictionary, where it can be handled like any other language feature. The tokenizer includes experimental code for that.
The old for parse ranking via corpus statistics needs to be revived. The issue can be illustrated with these example sentences:
"Please the customer, bring in the money"
"Please, turn off the lights"
In the first sentence, the comma acts as a conjunction of two directives (imperatives). In the second sentence, it is much too easy to mistake "please" for a verb, the comma for a conjunction, and come to the conclusion that one should please some unstated object, and then turn off the lights. (Perhaps one is pleasing by turning off the lights?)
When a sentence fails to parse, look for:
Poor agreement might be handled by giving a cost to mismatched lower-case connector letters.
An common phenomenon in English is that some words that one might expect to "properly" be present can disappear under various conditions. Below is a sampling of these. Some possible solutions are given below.
Expressions such as "Looks good" have an implicit "it" (also called a zero-it or phantom-it) in them; that is, the sentence should really parse as "(it) looks good". The dictionary could be simplified by admitting such phantom words explicitly, rather than modifying the grammar rules to allow such constructions. Other examples, with the phantom word in parenthesis, include:
This can extend to elided/unvoiced syllables:
Elided punctuation:
Normally, the subjects of imperatives must always be offset by a comma: "John, give me the hammer", but here, in muttering an oath, the comma is swallowed (unvoiced).
Some complex phantom constructions:
See also GitHub issue #224.
Actual ellipsis:
Here, the ellipsis stands for a subordinate clause, which attaches with not one, but two links: C+ & CV+ , and thus requires two words, not one. There is no way to have the ellipsis word to sink two connectors starting from the same word, and so some more complex mechanism is needed. The solution is to infer a second phantom ellipsis:
where the first ellipsis is a stand in for the subject of a subordinate clause, and the second stands in for an unknown verb.
Many (unstressed) syllables can be elided; in modern English, this occurs most commonly in the initial unstressed syllable:
Poorly punctuated sentences cause problems: for example:
"Mike was not first, nor was he last."
"Mike was not first nor was he last."
The one without the comma currently fails to parse. How can we deal with this in a simple, fast, elegant way? Similar questions for zero-copula and zero-that sentences.
Consider an argument between a professor and a dean, and the dean wants the professor to write a brilliant review. At the end of the argument, the dean exclaims: "I want the review brilliant!" This is a predicative adjective; clearly it means "I want the review [that you write to be] brilliant." However, taken out of context, such a construction is ungrammatical, as the predictiveness is not at all apparent, and it reads just as incorrectly as would "*Hey Joe, can you hand me that review brilliant?"
"Push button"
"Push button firmly"
The subject is a phantom; the subject is "you".
One possible solution is to perform a one-point compactification. The dictionary contains the phantom words, and their connectors. Ordinary disjuncts can link to these, but should do so using a special initial lower-case letter (say, 'z', in addition to 'h' and 'd' as is currently implemented). The parser, as it works, examines the initial letter of each connector: if it is 'z', then the usual pruning rules no longer apply, and one or more phantom words are selected out of the bucket of phantom words. (This bucket is kept out-of-line, it is not yet placed into sentence word sequence order, which is why the usual pruning rules get modified.) Otherwise, parsing continues as normal. At the end of parsing, if there are any phantom words that are linked, then all of the connectors on the disjunct must be satisfied (of course!) else the linkage is invalid. After parsing, the phantom words can be inserted into the sentence, with the location deduced from link lengths.
A more principled approach to fixing the phantom-word issue is to borrow the idea of re-writing from the theory of operator grammar. That is, certain phrases and constructions can be (should be) re-written into their "proper form", prior to parsing. The re-writing step would insert the missing words, then the parsing proceeds. One appeal of such an approach is that re-writing can also handle other "annoying" phenomena, such as typos (missing apostrophes, eg "lets" vs. "let's", "its" vs. "it's") as well as multi-word rewrites (eg "let's" vs. "let us", or "it's" vs. "it is").
Exactly how to implement this is unclear. However, it seems to open the door to more abstract, semantic analysis. Thus, for example, in Meaning-Text Theory (MTT), one must move between SSynt to DSynt structures. Such changes require a graph re-write from the surface syntax parse (eg provided by link-grammar) to the deep-syntactic structure. By contrast, handling phantom words by graph re-writing prior to parsing inverts the order of processing. This suggests that a more holistic approach is needed to graph rewriting: it must somehow be performed "during" parsing, so that parsing can both guide the insertion of the phantom words, and, simultaneously guide the deep syntactic rewrites.
Another interesting possibility arises with regards to tokenization. The current tokenizer is clever, in that it splits not only on whitespace, but can also strip off prefixes, suffixes, and perform certain limited kinds of morphological splitting. That is, it currently has the ability to re-write single-words into sequences of words. It currently does so in a conservative manner; the letters that compose a word are preserved, with a few exceptions, such as making spelling correction suggestions. The above considerations suggest that the boundary between tokenization and parsing needs to become both more fluid, and more tightly coupled.
Compare "she will be happier than before" to "she will be more happy than before." Current parser makes "happy" the head word, and "more" a modifier w/EA link. I believe the correct solution would be to make "more" the head (link it as a comparative), and make "happy" the dependent. This would harmonize rules for comparatives... and would eliminate/simplify rules for less,more.
However, this idea needs to be double-checked against, eg Hudson's word grammar. I'm confused on this issue ...
Currently, some links can act at "unlimited" length, while others can only be finite-length. eg determiners should be near the noun that they apply to. A better solution might be to employ a 'stretchiness' cost to some connectors: the longer they are, the higher the cost. (This eliminates the "unlimited_connector_set" in the dictionary).
Sometimes, the existence of one parse should suggest that another parse must surely be wrong: if one parse is possible, then the other parses must surely be unlikely. For example: the conjunction and.jg allows the "The Great Southern and Western Railroad" to be parsed as the single name of an entity. However, it also provides a pattern match for "John and Mike" as a single entity, which is almost certainly wrong. But "John and Mike" has an alternative parse, as a conventional-and -- a list of two people, and so the existence of this alternative (and correct) parse suggests that perhaps the entity-and is really very much the wrong parse. That is, the mere possibility of certain parses should strongly disfavor other possible parses. (Exception: Ben & Jerry's ice cream; however, in this case, we could recognize Ben & Jerry as the name of a proper brand; but this is outside of the "normal" dictionary (?) (but maybe should be in the dictionary!))
More examples: "high water" can have the connector A joining high.a and AN joining high.n; these two should either be collapsed into one, or one should be eliminated.
Use WordNet to reduce the number for parses for sentences containing compound verb phrases, such as "give up", "give off", etc.
To avoid a combinatorial explosion of parses, it would be nice to have an incremental parsing, phrase by phrase, using a sliding window algorithm to obtain the parse. Thus, for example, the parse of the last half of a long, run-on sentence should not be sensitive to the parse of the beginning of the sentence.
Doing so would help with combinatorial explosion. So, for example, if the first half of a sentence has 4 plausible parses, and the last half has 4 more, then currently, the parser reports 16 parses total. It would be much more useful if it could instead report the factored results: ie the four plausible parses for the first half, and the four plausible parses for the last half. This would ease the burden on downstream users of link-grammar.
This approach has at psychological support. Humans take long sentences and split them into smaller chunks that "hang together" as phrase- structures, viz compounded sentences. The most likely parse is the one where each of the quasi sub-sentences is parsed correctly.
This could be implemented by saving dangling right-going connectors into a parse context, and then, when another sentence fragment arrives, use that context in place of the left-wall.
This somewhat resembles the application of construction grammar ideas to the link-grammar dictionary. It also somewhat resembles Viterbi parsing to some fixed depth. Viz. do a full backward-forward parse for a phrase, and then, once this is done, take a Viterbi-step. That is, once the phrase is done, keep only the dangling connectors to the phrase, place a wall, and then step to the next part of the sentence.
Caution: watch out for garden-path sentences:
The horse raced past the barn fell.
The old man the boat.
The cotton clothing is made of grows in Mississippi.
The current parser parses these perfectly; a viterbi parser could trip on these.
Other benefits of a Viterbi decoder:
One may argue that Viterbi is a more natural, biological way of working with sequences. Some experimental, psychological support for this can be found at http://www.sciencedaily.com/releases/2012/09/120925143555.htm per Morten Christiansen, Cornell professor of psychology.
Consider the sentence "Thieves rob bank" -- a typical newspaper headline. LG currently fails to parse this, because the determiner is missing ("bank" is a count noun, not a mass noun, and thus requires a determiner. By contrast, "thieves rob water" parses just fine.) A fix for this would be to replace mandatory determiner links by (D- or {[[()]] & headline-flag}) which allows the D link to be omitted if the headline-flag bit is set. Here, "headline-flag" could be a new link-type, but one that is not subject to planarity constraints.
Note that this is easier said than done: if one simply adds a high-cost null link, and no headline-flag, then all sorts of ungrammatical sentences parse, with strange parses; while some grammatical sentences, which should parse, but currently don't, become parsable, but with crazy results.
More examples, from And Rosta:
"when boy meets girl"
"when bat strikes ball"
"both mother and baby are well"
A natural approach would be to replace fixed costs by formulas. This would allow the dialect/sociolect to be dynamically changeable. That is, rather than having a binary headline-flag, there would be a formula for the cost, which could be changed outside of the parsing loop. Such formulas could be used to enable/disable parsing specific to different dialects/sociolects, simply by altering the network of link costs.
A simpler alternative would be to have labeled costs (a cost vector), so that different dialects assign different costs to various links. A dialect would be specified during the parse, thus causing the costs for that dialect to be employed during parse ranking.
This has been implemented; what's missing is a practical tutorial on how this might be used.
A good reference for refining verb usage patterns is: "COBUILD GRAMMAR PATTERNS 1: VERBS from THE COBUILD SERIES", from THE BANK OF ENGLISH, HARPER COLLINS. Online at https://arts-ccr-002.bham.ac.uk/ccr/patgram/ and http://www.corpus.bham.ac.uk/publications/index.shtml
Currently tokenize.c tokenizes double-quotes and some UTF8 quotes (see the RPUNC/LPUNC class in en/4.0.affix - the QUOTES class is not used for that, but for capitalization support), with some very basic support in the English dictionary (see "% Quotation marks." there). However, it does not do this for the various "curly" UTF8 quotes, such as 'these' and “these”. This results is some ugly parsing for sentences containing such quotes. (Note that these are in 4.0.affix).
A mechanism is needed to disentangle the quoting from the quoted text, so that each can be parsed appropriately. It's somewhat unclear how to handle this within link-grammar. This is somewhat related to the problem of morphology (parsing words as if they were "mini-sentences",) idioms (phrases that are treated as if they were single words), set-phrase structures (if ... then ... not only... but also ...) which have a long-range structure similar to quoted text (he said ...).
See also GitHub issue #42.
"to be fishing": Link grammar offers four parses of "I was fishing for evidence", two of which are given low scores, and two are given high scores. Of the two with high scores, one parse is clearly bad. Its links "to be fishing.noun" as opposed to the correct "to be fishing.gerund". That is, I can be happy, healthy and wise, but I certainly cannot be fishing.noun. This is perhaps not just a bug in the structure of the dictionary, but is perhaps deeper: link-grammar has little or no concept of lexical units (ie collocations, idioms, institutional phrases), which thus allows parses with bad word-senses to sneak in.
The goal is to introduce more knowledge of lexical units into LG.
Different word senses can have different grammar rules (and thus, the links employed reveal the sense of the word): for example: "I tend to agree" vs. "I tend to the sheep" -- these employ two different meanings for the verb "tend", and the grammatical constructions allowed for one meaning are not the same as those allowed for the other. Yet, the link rules for "tend.v" have to accommodate both senses, thus making the rules rather complex. Worse, it potentially allows for non-sense constructions. If, instead, we allowed the dictionary to contain different rules for "tend.meaning1" and "tend.meaning2", the rules would simplify (at the cost of inflating the size of the dictionary).
Another example: "I fear so" -- the word "so" is only allowed with some, but not all, lexical senses of "fear". So eg "I fear so" is in the same semantic class as "I think so" or "I hope so", although other meanings of these verbs are otherwise quite different.
[Sin2004] "New evidence, new priorities, new attitudes" in J. Sinclair, (ed) (2004) How to use corpora in language teaching, Amsterdam: John Benjamins
See also: Pattern Grammar: A Corpus-Driven Approach to the Lexical Grammar of English
Susan Hunston and Gill Francis (University of Birmingham)
Amsterdam: John Benjamins (Studies in corpus linguistics, edited by Elena Tognini-Bonelli, volume 4), 2000
Book review.
“The Molecular Level of Lexical Semantics”, EA Nida, (1997) International Journal of Lexicography, 10(4): 265–274. ออนไลน์
The link-grammar provides several mechanisms to support circumpositions or even more complicated multi-word structures. One mechanism is by ordinary links; see the V, XJ and RJ links. The other mechanism is by means of post-processing rules. (For example, the "filler-it" SF rules use post-processing.) However, rules for many common forms have not yet been written. The general problem is of supporting structures that have "holes" in the middle, that require "lacing" to tie them together.
For a general theory, see catena.
For example, the adposition:
... from [xxx] on.
"He never said another word from then on."
"I promise to be quiet from now on."
"Keep going straight from that point on."
"We went straight from here on."
... from there on.
"We went straight, from the house on to the woods."
"We drove straight, from the hill onwards."
Note that multiple words can fit in the slot [xxx]. Note the tangling of another prepositional phrase: "... from [xxx] on to [yyy]"
More complicated collocations with holes include
"First.. next..."
"If ... then ..."
'Then' is optional ('then' is a 'null word'), for example:
"If it is raining, stay inside!"
"If it is raining, [then] stay inside!"
"if ... only ..." "If there were only more like you!"
"... not only, ... but also ..."
"As ..., so ..." "As it was commanded, so it shall be done"
"Either ... or ..."
"Both ... and ..." "Both June and Tom are coming"
"ought ... if ..." "That ought to be the case, if John is not lying"
"Someone ... who ..."
"Someone is outside who wants to see you"
"... for ... to ..."
"I need for you to come to my party"
The above are not currently supported. An example that is supported is the "non-referential it", eg
"It ... that ..."
"It seemed likely that John would go"
The above is supported by means of special disjuncts for 'it' and 'that', which must occur in the same post-processing domain.
See also:
http://www.phon.ucl.ac.uk/home/dick/enc2010/articles/extraposition.htm
http://www.phon.ucl.ac.uk/home/dick/enc2010/articles/relative-clause.htm
"...from X and from Y" "By X, and by Y, ..." Here, X and Y might be rather long phrases, containing other prepositions. In this case, the usual link-grammar linkage rules will typically conjoin "and from Y" to some preposition in X, instead of the correct link to "from X". Although adding a cost to keep the lengths of X and Y approximately equal can help, it would be even better to recognize the "...from ... and from..." pattern.
The correct solution for the "Either ... or ..." appears to be this:
---------------------------+---SJrs--+
+------???----------+ |
| +Ds**c+--SJls-+ +Ds**+
| | | | | |
either.r the lorry.n or.j-n the van.n
The wrong solution is
--------------------------+
+-----Dn-----+ +---SJrs---+
| +Ds**c+--SJn--+ +Ds**+
| | | | | |
neither.j the lorry.n nor.j-n the van.n
The problem with this is that "neither" must coordinate with "nor". That is, one cannot say "either.. nor..." "neither ... or ... " "neither ...and..." "but ... nor ..." The way I originally solved the coordination problem was to invent a new link called Dn, and a link SJn and to make sure that Dn could only connect to SJn, and nothing else. Thus, the lower-case "n" was used to propagate the coordination across two links. This demonstrates how powerful the link-grammar theory is: with proper subscripts, constraints can be propagated along links over large distances. However, this also makes the dictionary more complex, and the rules harder to write: coordination requires a lot of different links to be hooked together. And so I think that creating a single, new link, called ???, will make the coordination easy and direct. That is why I like that idea.
The ??? link should be the XJ link, which-see.
More idiomatic than the above examples: "...the chip on X's shoulder" "to do X a favour" "to give X a look"
The above are all examples of "set phrases" or "phrasemes", and are most commonly discussed in the context of MTT or Meaning-Text Theory of Igor Mel'cuk et al (search for "MTT Lexical Function" for more info). Mel'cuk treats set phrases as lexemes, and, for parsing, this is not directly relevant. However, insofar as phrasemes have a high mutual information content, they can dominate the syntactic structure of a sentence.
The current parse of "he wanted to look at and listen to everything." is inadequate: the link to "everything" needs to connect to "and", so that "listen to" and "look at" are treated as atomic verb phrases.
MTT suggests that perhaps the correct way to understand the contents of the post-processing rules is as an implementation of 'lexical functions' projected onto syntax. That is, the post-processing rules allow only certain syntactical constructions, and these are the kinds of constructions one typically sees in certain kinds of lexical functions.
Alternately, link-grammar suffers from a combinatoric explosion of possible parses of a given sentence. It would seem that lexical functions could be used to rule out many of these parses. On the other hand, the results are likely to be similar to that of statistical parse ranking (which presumably captures such quasi-idiomatic collocations at least weakly).
Ref. I. Mel'cuk: "Collocations and Lexical Functions", in ''Phraseology: theory, analysis, and applications'' Ed. Anthony Paul Cowie (1998) Oxford University Press pp. 23-54.
More generally, all of link-grammar could benefit from a MTT-izing of infrastructure.
Compare the above commentary on lexical functions to Hebrew morphological analysis. To quote Wikipedia:
This distinction between the word as a unit of speech and the root as a unit of meaning is even more important in the case of languages where roots have many different forms when used in actual words, as is the case in Semitic languages. In these, roots are formed by consonants alone, and different words (belonging to different parts of speech) are derived from the same root by inserting vowels. For example, in Hebrew, the root gdl represents the idea of largeness, and from it we have gadol and gdola (masculine and feminine forms of the adjective "big"), gadal "he grew", higdil "he magnified" and magdelet "magnifier", along with many other words such as godel "size" and migdal "tower".
Instead of hard-coding LL, declare which links are morpho links in the dict.
Version 6.0 will change Sentence to Sentence*, Linkage to Linkage* in the API. But perhaps this is a bad idea...