Giter Club home page Giter Club logo

transducer-wrapper's Introduction

Introduction

  1. This repository is an initial attempt towards making a full fleged python wrapper for the Apertium Lttoolbox module.
  2. In this repository a trivial wrapping of the transducer.cc module has been attempted
  3. Contents of the repository :
    • Nessecary header files
    • Nessecary .cc files
    • setup.py Disuitls file to set things up for building the wrapper
    • bugs.md Description of bugs and faults with this trivial system and a little insight on how to proceed with the project.
    • transducer.i The swig interface file
    • transducer.py and transducer.cxx These are generated files and can be generated by building
    • .o and .so files . These object and shared object files are also generated from the build

Steps to Build

  1. git clone repo
  2. cd repo
  3. swig -python -c++ transducer.i
  4. python setup.py build_ext --inplace
  5. g++ -c -fcip transducer_wrap.cxx transducer.cc -I/{{path to python header}} -std=c++11
  6. g++ -shared transducer.o transducer_wrap.o -o _transducer.so pkg-config --cflags --libs python3 lttoolbox -std=c++11

Alternate

  1. chmod +x run.sh
  2. ./run.sh

Steps to Run

  1. After the above steps are completed just open python in the terminal and try to import transducer
  2. Make sure to run the appropriate version of python

Note

  1. To get the path to python header in the environment, enter python-config --cflags in the terminal

Current Status of the wrapper

  • The current wrapper can take a transducer as input(ref test.py)
  • t.show() gives the following output for a transducer for beer: image

transducer-wrapper's People

Contributors

orgh0 avatar

Stargazers

 avatar

Watchers

 avatar

transducer-wrapper's Issues

Template Problem

When I try to print an object, I just get the swig definition of it and not the value,
Example: <transducer.Transducer; proxy of <Swig Object of type 'Transducer *' at 0x109a3e2d0> >

Adding templates did not change the situation

Any Help?

Syntax error for input in python

Backend code In alphabet.cc

void
Alphabet::includeSymbol(wstring const &s)
{
  if(slexic.find(s) == slexic.end())
  {
    int slexic_size = slexic.size();
    slexic[s] = -(slexic_size+1);
    slexicinv.push_back(s);
  }
}

When I try to run something like

import transducer
 a = transducer.Alphabet()
 a.includeSymbol(L'<n>')

I get a syntax error.

Following was the code I was trying to run in python
http://wiki.apertium.org/wiki/Lttoolbox_API_examples

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.