Skip to content

Newmm-safe is inconsistence #755

@chameleonTK

Description

@chameleonTK

I tried newmm-safe engine but it gave inconsistent results. It sometimes tokenized correctly but sometimes not.

Description

Example:
"ในฐานข้อมูลกฎหมายของเว็บไซต์ ทส. ข้อมูลและทรัพยากร ข้อมูลกฎหมายว่าด้วยป่าชุมชน CSV downloads กฎหมายแม่บท และกฎหมายลำดับรอง ของพระราชบัญญัติป่าชุมชน พ.ศ. 2562..."

It can correctly tokenize "ข้อมูลกฎหมายว่าด้วยป่าชุมชน" into ['ข้อมูล', 'กฎหมาย', 'ว่าด้วย', 'ป่าชุมชน']

If I changed the input into
"ในฐานข้อมูลกฎหมายของเว็บไซต์ ทส. ข้อมูลและทรัพยากร ข้อมูลกฎหมายว่าด้วยป่าชุมชน CSV downloads กฎหมายแม่บท และกฎหมายลำดับรอง ของพระราชบัญญัติป่าชุมชน พ.ศ. 2562... สำรวจ"

It tokenizes "ข้อมูลกฎหมายว่าด้วยป่าชุมชน" into ['ข้อมูล', 'กฎ', 'หม', 'าย', 'ว่าด้วย', 'ป่าชุมชน']

Expected results

It should produce the same results for both inputs.

Steps to reproduce

from pythainlp.tokenize import word_tokenize
docs = '''ในฐานข้อมูลกฎหมายของเว็บไซต์ ทส. ข้อมูลและทรัพยากร ข้อมูลกฎหมายว่าด้วยป่าชุมชน CSV downloads กฎหมายแม่บท และกฎหมายลำดับรอง ของพระราชบัญญัติป่าชุมชน พ.ศ. 2562... สำรวจ
'''
words = word_tokenize(docs, engine="newmm-safe", keep_whitespace=False)

print(words)

Your environment

  • PyThaiNLP version: 3.1.0
  • Python version: 3.9.7
  • Operating system and version: MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Hacktoberfestfor Hacktoberfest eventbugbugs in the library

    Type

    No type

    Projects

    Status

    In progress

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions