File size: 1,589 Bytes
908744d
fcdd824
3b61042
963072b
131d52a
8e5aaaf
908744d
245fc67
908744d
131d52a
 
 
 
 
35619f4
131d52a
 
25949d3
 
bde3485
 
 
 
a8e0a51
 
 
236c22c
 
 
 
 
 
 
 
8e5aaaf
d70862f
 
 
908744d
 
 
fcdd824
245fc67
 
 
d70862f
 
 
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from fastapi import FastAPI
from sinatools.utils import parser
from sinatools.DataDownload.downloader import download_file
from sinatools.DataDownload.downloader import download_folder_from_hf
import os



app = FastAPI()

SINATOOLS_DIR = os.path.expanduser("~/.sinatools")
os.makedirs(SINATOOLS_DIR, exist_ok=True)

# Destination path
dest_path = os.path.join(SINATOOLS_DIR)

# Download explicitly to the expected path
download_file(url="https://sina.birzeit.edu/lemmas_dic.pickle", dest_path=dest_path)
#download_folder_from_hf("TymaaHammouda/testing_lemmatizer_model", 'Lemmatizer_model')
download_file(url='https://sina.birzeit.edu/five_grams.pickle', dest_path=dest_path)
download_file(url='https://sina.birzeit.edu/four_grams.pickle', dest_path=dest_path)
download_file(url='https://sina.birzeit.edu/three_grams.pickle', dest_path=dest_path)
download_file(url='https://sina.birzeit.edu/two_grams.pickle', dest_path=dest_path)

from sinatools.morphology.morph_analyzer import analyze

# download_file('https://sina.birzeit.edu/lemmas_dic.pickle')


# args_path = hf_hub_download(
#     repo_id="SinaLab/Nested",
#     filename="args.json"
# )


download_file(url='https://sina.birzeit.edu/Wj27012000.tar.gz', dest_path=dest_path)
from sinatools.ner.entity_extractor import extract


@app.get("/")
def greet_json():
    
    # output =parser.arStrip('2023الجو جميلُ')
    # print(output)
    # lemmatizer_results = analyze('ذهب الولد الى المدرسة')

    ner_output = extract('ذهب محمد الى جامعة بيرزيت')
    return {"output": ner_output}