-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestWeighting.py
32 lines (25 loc) · 912 Bytes
/
TestWeighting.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from Weighting import Weighting
import os
from Preprocessing import Preprocessing
class TestWeighting:
@staticmethod
def main():
directory = input('Masukkan directory folder txt: ')
weighting = Weighting()
weighting.setText([
Preprocessing.stemming(
Preprocessing.filtering(
Preprocessing.tokenisasi(
Preprocessing.case_folding(
Preprocessing.cleaning(open(directory + '/' + filename, 'r', encoding="ISO-8859-1").read())
)
)
)
)
for filename in os.listdir(directory)
if filename.lower().endswith('.txt') and not filename.startswith('._')
])
print(weighting.getFeatures())
print(weighting.getTf())
print(weighting.getTIdf())
TestWeighting.main()