from gr_nlp_toolkit import Pipeline # Use this file only for testing purposes nlp_pos_ner_dp = Pipeline( "pos,ner,dp" ) # Instantiate the Pipeline with the DP, POS and NER processors doc_pos_ner_dp = nlp_pos_ner_dp( "Η Αργεντινή κέρδισε το Παγκόσμιο Κύπελλο το 2022" ) # Apply the pipeline to a sentence in Greek # Iterate over the generated tokens for token in doc_pos_ner_dp.tokens: print( f"Text: {token.text}," f" NER: {token.ner}," # Print the NER value of the token f" UPOS: {token.upos}, " # UPOS f" Morphological Features: {token.feats}, Head: {token.head}," f" Deprel: {token.deprel}" "\n---" ) nlp_g2g = Pipeline("g2g") # Instantiate the Pipeline with the G2G processor doc_g2g = nlp_g2g( "h thessaloniki einai mia poli sti boreia ellada" ) # Apply the pipeline to a sentence in Greek for token in doc_g2g.tokens: # Gather all the token.text values and join them with a space transliterated_text = " ".join([token.text for token in doc_g2g.tokens]) print(transliterated_text) # Print the transliterated text