영어 부품 태그거 라이브러리; Lingua의 루비 항구 :: en :: tagger
Perl Lingua의 Ruby Port :: 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 Tagset의 수정 된 버전입니다. 비 글체 문자가있는 태그는 데이터 구조에서 더 잘 작동하도록 재정의되었습니다. 또한 HTML 태그 <DT> 와의 혼동을 피하기 위해 "DET (Dectiner)"태그 (DET)가 '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 GEM을 설치하는 것이 좋습니다. 이를 통해 적절한 파일 권한을 보장하고 잠재적 인 문제를 피합니다. rbenv 또는 rvm 같은 Ruby 버전 관리자를 사용하여 Ruby 버전 및 보석을 관리하여이를 달성 할 수 있습니다.
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 버전 2.6.0을 사용한다고 가정합니다. 다른 버전을 사용하는 경우 그에 따라 경로를 수정해야합니다. ruby -v 실행하여 Ruby 버전을 찾을 수 있습니다.
권한 문제 :
설치 후 "해당 파일을로드 할 수 없음"오류가 발생하면 파일 권한이 잘못되었을 수 있습니다. 설치 중에 sudo 사용한 경우 권한 조정에 대한 지침을 준수해야합니다.
yoichiro hasebe (yohasebe [at] gmail.com)
이 GitHub 페이지의 오른쪽 열에 나열된 공동 작업자에게 감사드립니다.
이 루비 라이브러리는 CPAN에서 제공되는 Lingua :: en :: Tagger의 직접 항구입니다. 알고리즘/디자인의 중요한 부분에 대한 크레딧은 원래 PERL 버전의 저자 인 Aaron Coburn으로갑니다.
이 라이브러리는 GPL에 배포됩니다. 라이센스 파일을 참조하십시오.