ห้องสมุด Tagger ส่วนหนึ่งของภาษาอังกฤษ; พอร์ตทับทิมของ Lingua :: en :: tagger
พอร์ตทับทิมของ Perl Lingua :: en :: Tagger, ความน่าจะเป็นตามความน่าจะเป็น, tagger ที่ได้รับการฝึกฝนจากคลังข้อมูลที่กำหนดแท็ก POS ให้กับข้อความภาษาอังกฤษตามพจนานุกรมค้นหาและชุดของค่าความน่าจะเป็น Tagger กำหนดแท็กที่เหมาะสมตามความน่าจะเป็นแบบมีเงื่อนไข-ตรวจสอบแท็กก่อนหน้านี้เพื่อกำหนดแท็กที่เหมาะสมสำหรับคำปัจจุบัน คำที่ไม่รู้จักถูกจำแนกตามสัณฐานวิทยาของคำหรือสามารถตั้งค่าให้ถือว่าเป็นคำนามหรือส่วนอื่น ๆ ของการพูด Tagger ยังสกัดคำนามและวลีคำนามได้มากที่สุดเท่าที่จะทำได้โดยใช้ชุดของการแสดงออกปกติ
require 'engtagger'
# Create a parser object
tgr = EngTagger . new
# Sample text
text = "Alice chased the big fat cat."
# Add part-of-speech tags to text
tagged = tgr . add_tags ( text )
#=> "<nnp>Alice</nnp> <vbd>chased</vbd> <det>the</det> <jj>big</jj> <jj>fat</jj><nn>cat</nn> <pp>.</pp>"
# Get a list of all nouns and noun phrases with occurrence counts
word_list = tgr . get_words ( text )
#=> {"Alice"=>1, "cat"=>1, "fat cat"=>1, "big fat cat"=>1}
# Get a readable version of the tagged text
readable = tgr . get_readable ( text )
#=> "Alice/NNP chased/VBD the/DET big/JJ fat/JJ cat/NN ./PP"
# Get all nouns from a tagged output
nouns = tgr . get_nouns ( tagged )
#=> {"cat"=>1, "Alice"=>1}
# Get all proper nouns
proper = tgr . get_proper_nouns ( tagged )
#=> {"Alice"=>1}
# Get all past tense verbs
pt_verbs = tgr . get_past_tense_verbs ( tagged )
#=> {"chased"=>1}
# Get all the adjectives
adj = tgr . get_adjectives ( tagged )
#=> {"big"=>1, "fat"=>1}
# Get all noun phrases of any syntactic level
# (same as word_list but take a tagged input)
nps = tgr . get_noun_phrases ( tagged )
#=> {"Alice"=>1, "cat"=>1, "fat cat"=>1, "big fat cat"=>1} ชุดของแท็ก POS ที่ใช้ที่นี่เป็นเวอร์ชันที่แก้ไขของชุดแท็ก Penn TreeBank แท็กที่มีอักขระที่ไม่ใช่ตัวอักษรได้รับการนิยามใหม่เพื่อให้ทำงานได้ดีขึ้นในโครงสร้างข้อมูลของเรา นอกจากนี้แท็ก "deMiner" (DET) ได้รับการเปลี่ยนแปลงจาก 'DT' เพื่อหลีกเลี่ยงความสับสนกับแท็ก HTML, <DT>
CC Conjunction, coordinating and, or
CD Adjective, cardinal number 3, fifteen
DET Determiner this, each, some
EX Pronoun, existential there there
FW Foreign words
IN Preposition / Conjunction for, of, although, that
JJ Adjective happy, bad
JJR Adjective, comparative happier, worse
JJS Adjective, superlative happiest, worst
LS Symbol, list item A, A.
MD Verb, modal can, could, 'll
NN Noun aircraft, data
NNP Noun, proper London, Michael
NNPS Noun, proper, plural Australians, Methodists
NNS Noun, plural women, books
PDT Determiner, prequalifier quite, all, half
POS Possessive 's, '
PRP Determiner, possessive second mine, yours
PRPS Determiner, possessive their, your
RB Adverb often, not, very, here
RBR Adverb, comparative faster
RBS Adverb, superlative fastest
RP Adverb, particle up, off, out
SYM Symbol *
TO Preposition to
UH Interjection oh, yes, mmm
VB Verb, infinitive take, live
VBD Verb, past tense took, lived
VBG Verb, gerund taking, living
VBN Verb, past/passive participle taken, lived
VBP Verb, base present form take, live
VBZ Verb, present 3SG -s form takes, lives
WDT Determiner, question which, whatever
WP Pronoun, question who, whoever
WPS Determiner, possessive & question whose
WRB Adverb, question when, how, however
PP Punctuation, sentence ender ., !, ?
PPC Punctuation, comma ,
PPD Punctuation, dollar sign $
PPL Punctuation, quotation mark left ``
PPR Punctuation, quotation mark right ''
PPS Punctuation, colon, semicolon, elipsis :, ..., -
LRB Punctuation, left bracket (, {, [
RRB Punctuation, right bracket ), }, ]
วิธีที่แนะนำ (ไม่มี sudo):
ขอแนะนำให้ติดตั้งอัญมณี engtagger ภายในสภาพแวดล้อมผู้ใช้ของคุณโดยไม่มีสิทธิ์รูท สิ่งนี้ทำให้มั่นใจได้ว่าการอนุญาตไฟล์ที่เหมาะสมและหลีกเลี่ยงปัญหาที่อาจเกิดขึ้น คุณสามารถทำสิ่งนี้ได้โดยใช้ผู้จัดการเวอร์ชันทับทิมเช่น rbenv หรือ rvm เพื่อจัดการเวอร์ชันทับทิมและอัญมณีของคุณ
ในการติดตั้งโดยไม่ต้อง sudo เพียงแค่เรียกใช้:
gem install engtaggerวิธีการทางเลือก (กับ sudo):
หากคุณต้องใช้ sudo สำหรับการติดตั้งคุณจะต้องปรับสิทธิ์ไฟล์หลังจากนั้นเพื่อให้แน่ใจว่าการเข้าถึง
sudo : sudo gem install engtaggersudo chown -R $( whoami ) /Library/Ruby/Gems/2.6.0/gems/engtagger-0.4.1 หมายเหตุ: เส้นทางข้างต้นถือว่าคุณใช้ Ruby Version 2.6.0 หากคุณใช้เวอร์ชันอื่นคุณจะต้องแก้ไขเส้นทางตามนั้น คุณสามารถค้นหาเวอร์ชันทับทิมของคุณได้โดยใช้ ruby -v
ปัญหาการอนุญาต:
หากคุณพบข้อผิดพลาด "ไม่สามารถโหลดไฟล์ดังกล่าวได้" หลังจากการติดตั้งอาจเกิดจากการอนุญาตไฟล์ที่ไม่ถูกต้อง ตรวจสอบให้แน่ใจว่าคุณได้ทำตามคำแนะนำสำหรับการปรับสิทธิ์หากคุณใช้ sudo ในระหว่างการติดตั้ง
Yoichiro Hasebe (yohasebe [at] gmail.com)
ขอบคุณมากสำหรับผู้ทำงานร่วมกันที่ระบุไว้ในคอลัมน์ที่ถูกต้องของหน้า GitHub นี้
ห้องสมุดทับทิมนี้เป็นพอร์ตโดยตรงของ Lingua :: en :: tagger มีอยู่ที่ CPAN เครดิตสำหรับส่วนสำคัญของอัลกอริทึม/การออกแบบจึงไปที่ Aaron Coburn ผู้เขียนรุ่น Perl ดั้งเดิม
ห้องสมุดนี้มีการแจกจ่ายภายใต้ GPL โปรดดูไฟล์ใบอนุญาต