Code Monkey home page Code Monkey logo

ezafeh-detection-with-hazm's Introduction

cpp-hazm with kasreh ezafeh example

C++ wrappers of the Python's Hazm module Hazm c++ wrapper from tihu Contributor(s): Mostafa Sedaghat Joo ([email protected])

Usage

#include "hazm.h"

#include <iostream>
#include <string>
using namespace Hazm;

int main()
{
    Normalizer normalizer;
    POSTagger tagger("pos_tagger.model");
    std::string normlized_text = normalizer.normalize("جعبه اسرار این معما در پناه حق باز شده است.");
    std::string  processed_sentences = "";
    for (auto &sentence: sent_tokenize(normlized_text)) {
        std::vector<std::string> words = word_tokenize(sentence);
        std::string fixed_words = "";
        for (auto &word: tagger.tag(words)) {
            if ((word.type).substr(word.type.length()-1,1) == "Z" ) { 
                if ((word.word).substr(word.word.length()-2,2) != "ِ")  {
                    if ( (word.word).substr(word.word.length()-2,2) == "ه" and (word.word).substr(word.word.length()-4,2) != "ا") { 
                        word.word += "‌ی";
                    }
                }
                word.word += "ِ";
            }
            fixed_words += word.word + " ";
        }
        processed_sentences += fixed_words;
        
    }
    std::cout << processed_sentences << std::endl;
    return 0;
}

Installation

You needs python-dev c++ and also Python's hazm module. You can install it using pip:

pip install hazm
run ./make

Run

run ./ezafeh for test

ezafeh-detection-with-hazm's People

Contributors

realbardia avatar gyroing avatar

Stargazers

 avatar  avatar

Forkers

soebb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.