Skip to content

In this repository, we provide a joint neural model based on BERT and two BiLSTM neural networks, which can jointly recognize the Kasreh Ezafeh (Genitive Conjunction /e/) and Comma in a Persian sentence or text.

License

Notifications You must be signed in to change notification settings

HRSadeghi/Joint_Comma_and_Kasreh_Recognizer

Repository files navigation

Joint_Comma_and_Kasreh_Recognizer

This package includes source code for recognizing and adding Persian Kasre and Persian Comma to text.

Installation

First, clone the project

git clone https://github.com/HRSadeghi/Joint_Comma_and_Kasreh_Recognizer.git

And then, install the dependencies
pip install -r requirements.txt

Train model

To train the model, just use the following command

python train.py --checkpoint_dir /path/to/checkpoint_dir --n_saved_ckpts 2 --batch_size 64 --epochs 2 --no_of_bert_layer 7

Inference

To use the model for one sentence, just run the following command

python inference.py --input_sen 'به هر حال آخرین عکس را داریم که البته دورترین است' --no_of_bert_layer 7 --checkpoint_dir /path/to/checkpoint_dir

But if you want to give the model a text file with one sentence per line, run the following command

python inference.py --input_text_file /path/to/input_file.txt --output_text_file path/to/result_file.txt --no_of_bert_layer 7 --checkpoint_dir /path/to/checkpoint_dir

About

In this repository, we provide a joint neural model based on BERT and two BiLSTM neural networks, which can jointly recognize the Kasreh Ezafeh (Genitive Conjunction /e/) and Comma in a Persian sentence or text.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages