Skip to content

Simple Script to undo Farasa Segmentation, compatible with AraBERT pre-segmentation

Notifications You must be signed in to change notification settings

WissamAntoun/Farasa_Desegmenter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Farasa Desegmenter (Unsegment)

Simple Script to undo Farasa Segmentation

Tested on 106K words Error rate: 0.074% Error Count: 79

Functions docs:

To import the functions use from desegmentors import *

  • desegmentword: Word segmentor that takes a Farasa Segmented Word and removes the '+' signs
>>> desegment("ال+يومي+ة")
اليومية
>>> desegment("ل+ال+يومي+ة") #Handles Lam + Al-Ataarif
لليومية
  • desegment_line: Simple wrapper over desegmentword that splits a string by the sep character
>>> desegment_line('ال+دراس+ات ال+نظري+ة ل+ال+تصميم ال+حديث')
الدراسات النظرية للتصميم الحديث
  • desegment_arabert: Use this function if sentence tokenization was done using from arabert.preprocess_arabert import preprocess with Farasa enabled. AraBERT segmentation using Farasa adds a space after the '+' for prefixes, and after before the '+' for suffixes
>>> desegment_arabert("ال+ دراس +ات ال+ نظري +ة ل+ ال+ تصميم ال+ حديث")
الدراسات النظرية للتصميم الحديث

About

Simple Script to undo Farasa Segmentation, compatible with AraBERT pre-segmentation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages