https://github.com/dcavar/fomajni

A Java JNI interface for Foma (a Finite State Transducer compiler for NLP)

https://github.com/dcavar/fomajni

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.7%) to scientific vocabulary

Keywords

cpp finite-state-transducer foma java jni morphology nlp
Last synced: 4 months ago · JSON representation

Repository

A Java JNI interface for Foma (a Finite State Transducer compiler for NLP)

Basic Info
Statistics
  • Stars: 6
  • Watchers: 2
  • Forks: 1
  • Open Issues: 1
  • Releases: 0
Topics
cpp finite-state-transducer foma java jni morphology nlp
Created over 7 years ago · Last pushed almost 6 years ago
Metadata Files
Readme License

README.md

fomaJNI

Copyright 2018 by Damir Cavar

Version: 0.1

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Introduction

The purpose of this code is to provide a C++ wrapper and a Java JNI interface to the binary foma library. As the description of foma says: "Foma is a compiler, programming language, and C library for constructing finite-state automata and transducers for various uses.", and in our case in particular for Natural Language Processing (NLP).

Foma is very efficient and fast as a morphological analyzer and there are numerous morphologies or grammars publicly available for many languages.

I provide a simple binary English Finite State Transducer (eng.fst) in the example for the use with Foma. See details about how this loads in the Java and C++ code.

I have tested the code on Linux (Fedora 28) and Mac OSX. The C++ code should work with any C++11 compatible compiler. The Java code was compiled and tested with the current Oracle Java 10 release.

You will need to have:

  • a Java SDK
  • a C++ compiler
  • Foma installed, including .h include files and libraries, you can tweak CMakeLists.txt to adapt to static or dynamic linking of those
  • CMake

Follow the documentation of all these packages to learn more about their use, setup, configuration.

Instructions

To build the system on Linux or MacOS, run the build.sh script.

These are the individual steps:

To compile the C++ components into the target library run:

cmake .
make

To generate the test binary:

g++ -std=c++11  -L"/usr/local/lib" -L. -lfoma -lz -I"$JAVA_HOME/include" -I"$JAVA_HOME/include/darwin" test.c FomaWrapper.cpp -o test

To generate the header and class file, assuming you use Java 8 or newer:

javac -h include foma/App.java

Then check App.c and run on Mac:

g++ -fPIC -I"$JAVA_HOME/include" -I"$JAVA_HOME/include/darwin" -dynamiclib -o libfomaJNI.dylib App.cpp FomaWrapper.cpp

On Linux do this:

g++ -fPIC -I"$JAVA_HOME/include" -I"$JAVA_HOME/include/linux" -shared -o libfomaJNI.so App.cpp FomaWrapper.cpp

Run the app now with:

java -Djava.library.path=. foma.App

Owner

  • Name: Damir Cavar
  • Login: dcavar
  • Kind: user
  • Location: Bloomington, IN
  • Company: Indiana University

GitHub Events

Total
Last Year

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 7
  • Total Committers: 2
  • Avg Commits per committer: 3.5
  • Development Distribution Score (DDS): 0.143
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Damir Cavar d****r@g****m 6
Damir Cavar d****r@m****m 1
Committer Domains (Top 20 + Academic)
me.com: 1

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 1
  • Total pull requests: 1
  • Average time to close issues: 19 minutes
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • miniHive (1)
Pull Request Authors
  • miniHive (1)
Top Labels
Issue Labels
Pull Request Labels