ฉันต้องการแยก noun_phrases ของข้อความภาษาดัตช์โดยใช้โมเดล nl_core_news_sm โดย spacy มันจะส่งคืนรายการว่าง ในทางกลับกันโมเดลภาษาอังกฤษที่เทียบเท่า en_core_web_sm จะให้รายการ noun_chunks (noun_phrases)
นี่เป็นพฤติกรรมปกติหรือไม่? กล่าวคือ moedel ภาษาดัตช์ไม่รวมตัวคั่น noun_phrases และโมเดลภาษาอังกฤษมีอะไรบ้าง หรือฉันกำลังทำอะไรผิด?
string='''In een wereld waarin je wordt overspoeld met informatie, is het prettig om een nieuwsbron te hebben met heldere stukken, die de ruimte laten om je eigen mening te vormen.'''
nlp = spacy.load('nl_core_news_sm')
print(dir(doc))
print(doc.noun_chunks)
list_chunks=[chunk for chunk in doc.noun_chunks]
for chunk in doc.noun_chunks:
print(chunk.text)
ผลลัพธ์ที่นี่คือ list_chunks คือ [] และแน่นอนว่าไม่มีสิ่งใดถูกพิมพ์ในลูป
ฉันใช้ dir(doc) เพื่อเปรียบเทียบวิธีการที่มีอยู่เพื่อเปรียบเทียบกับโมเดลภาษาอังกฤษ พวกเขาก็เหมือน ๆ กัน.
nlp_en = spacy.load('en_core_web_sm')
string='''They normally organises a wide range of activities for kids in the summer holidays. Due to the virus, these have all been cancelled'''
doc2=nlp_en(string)
print(dir(doc2))
print(doc2.noun_chunks)
for chunk in doc2.noun_chunks:
print(chunk.text)
ในภาษาอังกฤษมันใช้งานได้
มีความคิดบ้างไหม?