Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-118
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2023-118
2023-118
Commits
a0b59595
Commit
a0b59595
authored
Aug 24, 2023
by
W.G.G.A. Supun Sameera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated for new version
parent
2df7ff9b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
205 additions
and
7 deletions
+205
-7
sinlingua/preprocessor/stemmer.py
sinlingua/preprocessor/stemmer.py
+5
-4
sinlingua/preprocessor/stopword_remover.py
sinlingua/preprocessor/stopword_remover.py
+2
-3
sinlingua/src/preprocessor_resources.py
sinlingua/src/preprocessor_resources.py
+198
-0
No files found.
sinlingua/preprocessor/stemmer.py
View file @
a0b59595
...
...
@@ -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
:
...
...
sinlingua/preprocessor/stopword_remover.py
View file @
a0b59595
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
()
...
...
sinlingua/src/preprocessor_resources.py
0 → 100644
View file @
a0b59595
suffixes_list
=
[]
suffix_list_dependent_vowels
=
[]
stop_words
=
[
සහ
,
සමග
,
සමඟ
,
අහා
,
ආහ්
,
ආ
,
ඕහෝ
,
අනේ
,
අඳෝ
,
අපොයි
,
අපෝ
,
අයියෝ
,
ආයි
,
ඌයි
,
චී
,
චිහ්
,
චික්
,
හෝ
,
දෝ
,
දෝහෝ
,
මෙන්
,
සේ
,
වැනි
,
බඳු
,
වන්
,
අයුරු
,
අයුරින්
,
ලෙස
,
වැඩි
,
ශ්රී
,
හා
,
ය
,
නිසා
,
නිසාවෙන්
,
බවට
,
බව
,
බවෙන්
,
නම්
,
වැඩි
,
සිට
,
දී
,
මහා
,
මහ
,
පමණ
,
පමණින්
,
පමන
,
වන
,
විට
,
විටින්
,
මේ
,
මෙලෙස
,
මෙයින්
,
ඇති
,
ලෙස
,
සිදු
,
වශයෙන්
,
යන
,
සඳහා
,
මගින්
,
හෝ
,
ඉතා
,
ඒ
,
එම
,
ද
,
අතර
,
විසින්
,
සමග
,
පිළිබඳව
,
පිළිබඳ
,
තුළ
,
බව
,
වැනි
,
මහ
,
මෙම
,
මෙහි
,
මේ
,
වෙත
,
වෙතින්
,
වෙතට
,
වෙනුවෙන්
,
වෙනුවට
,
වෙන
,
ගැන
,
නෑ
,
අනුව
,
නව
,
පිළිබඳ
,
විශේෂ
,
දැනට
,
එහෙන්
,
මෙහෙන්
,
එහේ
,
මෙහේ
,
ම
,
තවත්
,
තව
,
සහ
,
දක්වා
,
ට
,
ගේ
,
එ
,
ක
,
ක්
,
බවත්
,
බවද
,
මත
,
ඇතුලු
,
ඇතුළු
,
මෙසේ
,
වඩා
,
වඩාත්ම
,
නිති
,
නිතිත්
,
නිතොර
,
නිතර
,
ඉක්බිති
,
දැන්
,
යලි
,
පුන
,
ඉතින්
,
සිට
,
සිටන්
,
පටන්
,
තෙක්
,
දක්වා
,
සා
,
තාක්
,
තුවක්
,
පවා
,
ද
,
හෝ
,
වත්
,
විනා
,
හැර
,
මිස
,
මුත්
,
කිම
,
කිම්
,
ඇයි
,
මන්ද
,
හෙවත්
,
නොහොත්
,
පතා
,
පාසා
,
ගානෙ
,
තව
,
ඉතා
,
බොහෝ
,
වහා
,
සෙද
,
සැනින්
,
හනික
,
එම්බා
,
එම්බල
,
බොල
,
නම්
,
වනාහි
,
කලී
,
ඉඳුරා
,
අන්න
,
ඔන්න
,
මෙන්න
,
උදෙසා
,
පිණිස
,
සඳහා
,
අරබයා
,
නිසා
,
එනිසා
,
එබැවින්
,
බැවින්
,
හෙයින්
,
සේක්
,
සේක
,
ගැන
,
අනුව
,
පරිදි
,
විට
,
තෙක්
,
මෙතෙක්
,
මේතාක්
,
තුරු
,
තුරා
,
තුරාවට
,
තුලින්
,
නමුත්
,
එනමුත්
,
වස්
,
මෙන්
,
ලෙස
,
පරිදි
,
එහෙත්
]
stem_dictionary
=
{}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment