https://github.com/dcavar/fomajni
A Java JNI interface for Foma (a Finite State Transducer compiler for NLP)
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
Repository
A Java JNI interface for Foma (a Finite State Transducer compiler for NLP)
Basic Info
- Host: GitHub
- Owner: dcavar
- License: apache-2.0
- Language: C++
- Default Branch: master
- Homepage: http://damir.cavar.me/2018-08-03-Java_JNI_CPP_Foma_Wrapper_4_NLP_Morphology
- Size: 105 KB
Statistics
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 1
- Releases: 0
Topics
Metadata Files
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
- Website: http://damir.cavar.me/
- Repositories: 29
- Profile: https://github.com/dcavar
GitHub Events
Total
Last Year
Committers
Last synced: 10 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Damir Cavar | d****r@g****m | 6 |
| Damir Cavar | d****r@m****m | 1 |
Committer Domains (Top 20 + Academic)
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)