Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Application of NMT+Word alignment models for cross-lingual lexical substitution task

Notifications You must be signed in to change notification settings

Vitaly-Protasov/NMT-for-CLLS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NMT-for-CLLS Open In Colab

Application of NMT+Word alignment models for cross-lingual lexical substitution task

Firstly

pip install -r requirements.txt
bash init.sh

Get NMT

  • For example
from nmt import NMT_easy


model_name = 'opus-mt' # see https://github.com/UKPLab/EasyNMT

language = 'es'
outpath = 'test.csv'

nmt_model = NMT_easy(model_name)
nmt_semeval2010_2 = nmt_model.make_nmt(<your_df: pd.DataFrame>, language, outpath)
  • Or
python3 nmt.py --df_path <path_to_df> --language <your_language> --model_name <nmt_model_name>

Get alignments

  • For example
from alignments import Alignments

alignment_models = Alignments()
positions1, spanish_tws1 = alignment_models.model_1(df)
positions2, spanish_tws2 = alignment_models.model_2(df)

About

Application of NMT+Word alignment models for cross-lingual lexical substitution task

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published