updated for new version

parent 2df7ff9b
......@@ -3,6 +3,7 @@ import functools
from typing import Union
import pygtrie as trie
from sinlingua.config import RESOURCE_PATH
from sinlingua.src.preprocessor_resources import suffix_list_dependent_vowels, suffixes_list, stem_dictionary
dependent_vowels = {
"අ": "ා",
......@@ -50,10 +51,10 @@ def _load_lists(file: str) -> list:
class SinhalaStemmer:
def __init__(self):
super().__init__()
self.stem_list = _load_stem_dictionary()
self.suffixes = _load_suffixes(file='suffixes_list.txt')
self.suffixes_normal = _load_lists(file='suffixes_list.txt')
self.suffixes_dependent_vowels = _load_lists(file='suffix_list_dependent_vowels.txt')
self.stem_list = stem_dictionary
# self.suffixes = _load_suffixes(file='suffixes_list.txt')
self.suffixes_normal = suffixes_list
self.suffixes_dependent_vowels = suffix_list_dependent_vowels
def step_one(self, text: str):
for items in self.stem_list:
......
from sinlingua.src.preprocessor_resources import stop_words
import os
class StopWordRemover:
def __init__(self):
stop_words_path = os.path.join(os.path.dirname(__file__), '..', 'resources', 'stop_words.txt')
with open(stop_words_path, 'r', encoding='utf-8') as file:
self.stop_words = set(word.strip() for word in file.readlines())
self.stop_words = stop_words
def remove_stop_words(self, text):
words = text.split()
......
suffixes_list = []
suffix_list_dependent_vowels = []
stop_words = [
සහ,
සමග,
සමඟ,
අහා,
ආහ්,
,
ඕහෝ,
අනේ,
අඳෝ,
අපොයි,
අපෝ,
අයියෝ,
ආයි,
ඌයි,
චී,
චිහ්,
චික්,
හෝ‍,
දෝ,
දෝහෝ,
මෙන්,
සේ,
වැනි,
බඳු,
වන්,
අයුරු,
අයුරින්,
ලෙස,
වැඩි,
ශ්‍රී,
හා,
,
නිසා,
නිසාවෙන්,
බවට,
බව,
බවෙන්,
නම්,
වැඩි,
සිට,
දී,
මහා,
මහ,
පමණ,
පමණින්,
පමන,
වන,
විට,
විටින්,
මේ,
මෙලෙස,
මෙයින්,
ඇති,
ලෙස,
සිදු,
වශයෙන්,
යන,
සඳහා,
මගින්,
හෝ‍,
ඉතා,
,
එම,
,
අතර,
විසින්,
සමග,
පිළිබඳව,
පිළිබඳ,
තුළ,
බව,
වැනි,
මහ,
මෙම,
මෙහි,
මේ,
වෙත,
වෙතින්,
වෙතට,
වෙනුවෙන්,
වෙනුවට,
වෙන,
ගැන,
නෑ,
අනුව,
නව,
පිළිබඳ,
විශේෂ,
දැනට,
එහෙන්,
මෙහෙන්,
එහේ,
මෙහේ,
,
තවත්,
තව,
සහ,
දක්වා,
,
ගේ,
,
,
ක්,
බවත්,
බවද,
මත,
ඇතුලු,
ඇතුළු,
මෙසේ,
වඩා,
වඩාත්ම,
නිති,
නිතිත්,
නිතොර,
නිතර,
ඉක්බිති,
දැන්,
යලි,
පුන,
ඉතින්,
සිට,
සිටන්,
පටන්,
තෙක්,
දක්වා,
සා,
තාක්,
තුවක්,
පවා,
,
හෝ‍,
වත්,
විනා,
හැර,
මිස,
මුත්,
කිම,
කිම්,
ඇයි,
මන්ද,
හෙවත්,
නොහොත්,
පතා,
පාසා,
ගානෙ,
තව,
ඉතා,
බොහෝ,
වහා,
සෙද,
සැනින්,
හනික,
එම්බා,
එම්බල,
බොල,
නම්,
වනාහි,
කලී,
ඉඳුරා,
අන්න,
ඔන්න,
මෙන්න,
උදෙසා,
පිණිස,
සඳහා,
අරබයා,
නිසා,
එනිසා,
එබැවින්,
බැවින්,
හෙයින්,
සේක්,
සේක,
ගැන,
අනුව,
පරිදි,
විට,
තෙක්,
මෙතෙක්,
මේතාක්,
තුරු,
තුරා,
තුරාවට,
තුලින්,
නමුත්,
එනමුත්,
වස්,
මෙන්,
ලෙස,
පරිදි,
එහෙත්]
stem_dictionary = {}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment