-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfarasa.py
More file actions
30 lines (24 loc) · 873 Bytes
/
farasa.py
File metadata and controls
30 lines (24 loc) · 873 Bytes
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
# -*- coding: utf-8 -*-
import jpype
import jpype.imports
from jpype.types import *
from jpype import JPackage
from jpype import JClass
# Launch the JVM
if not jpype.isJVMStarted():
jpype.startJVM( "-ea", "-Djava.class.path=E:\\Projects\\GitHub Repos\\SentimentMap\\FarasaSegmenterJar.jar")
import java.lang
#from java.lang import System
#print(System.getProperty("java.class.path"))
f1 = JClass('com.qcri.farasa.segmenter.Farasa')
farasa = f1()
def lemmatize(sentence):
sentence = " ".join(sentence)
print(sentence)
lemmatized = farasa.lemmatizeLine(sentence)
lemmatized = list(lemmatized)
return lemmatized
def shutdown():
jpype.shutdownJVM()
#text = "RT @AssiellMustafa: +1 والله ، أنا بشكركوا جدا أنا من غيركو نثينج ربنا يخليكوا ليا https://t.co/m6AkXM0n6k"
#print(lemmatize(text))