Skip to content

Commit

Permalink
Releasse version 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
adhaamehab committed May 5, 2019
1 parent 9ec6fdf commit fe1c307
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 20 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include models/*
9 changes: 4 additions & 5 deletions arabicnlp/core.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import re
from .preprocessing import ArabicStemmer

from .models import tags as _tags

available_models = (
('POST', 'LSTM'),
('POST', 'NGRAM')
('POST', 'LSTM')
)

stemmer = ArabicStemmer()
Expand All @@ -17,8 +16,8 @@ def stem(text):
return [stemmer.stem(token) for token in tokens(text)]


def tags(text, model='LSTM'):
return []
def tags(text):
return _tags(text)


def correct(text):
Expand Down
2 changes: 1 addition & 1 deletion arabicnlp/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .pos_tagger.py import tags
from .pos_tagger import tags
15 changes: 2 additions & 13 deletions arabicnlp/models/pos_tagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def _tokens(text):


model = load_model('models/post_lstm_march_2019_.h5', custom_objects={'ignore_accuracy': _ignore_class_accuracy()})
global graph
graph = tf.get_default_graph()

word2index = pickle.load(open('models/word2index.bin', 'rb'))
tag2index = pickle.load(open('models/tag2index.bin', 'rb'))
Expand All @@ -78,16 +80,3 @@ def tags( sentence):
break
result[value] = pre_result[idx]
return result

'''
load word2index
load tag2index
_MAX_LENGTH = 398
seq = str to seq
preres = predict(seq)
res = logits_to_tokens(predictions, {i: t for t, i in tag2index.items()})
for idx, value in enumerate(tokens(inp)):
print(value,' : ' , res[0][idx])
'''
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
version='0.1.0',
description="Python package for arabic NLP",
long_description="Python package for processing arabic language with features like sentiment analysis and part-of-speech tagging",

# The project URL.
url='https://github.com/adhaamehab/arabicnlp',

Expand All @@ -23,4 +22,5 @@
'Programming Language :: Python :: 3.6',
],
packages=find_packages(),
include_package_data=True
)

0 comments on commit fe1c307

Please sign in to comment.