{"id":18754074,"url":"https://github.com/dcavar/fomajni","last_synced_at":"2025-04-13T00:32:00.443Z","repository":{"id":150220985,"uuid":"143428237","full_name":"dcavar/fomaJNI","owner":"dcavar","description":"A Java JNI interface for Foma (a Finite State Transducer compiler for NLP)","archived":false,"fork":false,"pushed_at":"2020-05-17T14:07:48.000Z","size":108,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T18:57:26.350Z","etag":null,"topics":["cpp","finite-state-transducer","foma","java","jni","morphology","nlp"],"latest_commit_sha":null,"homepage":"http://damir.cavar.me/2018-08-03-Java_JNI_CPP_Foma_Wrapper_4_NLP_Morphology","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcavar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-03T13:04:07.000Z","updated_at":"2021-05-01T15:05:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"f39b6449-64e3-4c37-b10f-43b07906dcbe","html_url":"https://github.com/dcavar/fomaJNI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcavar%2FfomaJNI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcavar%2FfomaJNI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcavar%2FfomaJNI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcavar%2FfomaJNI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcavar","download_url":"https://codeload.github.com/dcavar/fomaJNI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650590,"owners_count":21139670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","finite-state-transducer","foma","java","jni","morphology","nlp"],"created_at":"2024-11-07T17:27:59.774Z","updated_at":"2025-04-13T00:32:00.433Z","avatar_url":"https://github.com/dcavar.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fomaJNI\n\nCopyright 2018 by [Damir Cavar](http://damir.cavar.me/)\n\nVersion: 0.1\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n\n\n## Introduction\n\nThe purpose of this code is to provide a C++ wrapper and a Java JNI interface to the binary [foma](https://fomafst.github.io) library. As the description of [foma](https://fomafst.github.io) 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).\n\n[Foma](https://fomafst.github.io) is very efficient and fast as a morphological analyzer and there are numerous morphologies or grammars publicly available for many languages.\n\nI 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.\n\nI 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.\n\nYou will need to have:\n\n- a Java SDK\n- a C++ compiler\n- Foma installed, including .h include files and libraries, you can tweak CMakeLists.txt to adapt to static or dynamic linking of those\n- CMake\n\nFollow the documentation of all these packages to learn more about their use, setup, configuration.\n\n\n## Instructions\n\nTo build the system on Linux or MacOS, run the build.sh script.\n\nThese are the individual steps:\n\nTo compile the C++ components into the target library run:\n\n\tcmake .\n\tmake\n\nTo generate the test binary:\n\n\tg++ -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\n\nTo generate the header and class file, assuming you use Java 8 or newer:\n\n\tjavac -h include foma/App.java\n\nThen check App.c and run on Mac:\n\n\tg++ -fPIC -I\"$JAVA_HOME/include\" -I\"$JAVA_HOME/include/darwin\" -dynamiclib -o libfomaJNI.dylib App.cpp FomaWrapper.cpp\n\nOn Linux do this:\n\n\tg++ -fPIC -I\"$JAVA_HOME/include\" -I\"$JAVA_HOME/include/linux\" -shared -o libfomaJNI.so App.cpp FomaWrapper.cpp\n\nRun the app now with:\n\n\tjava -Djava.library.path=. foma.App\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcavar%2Ffomajni","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcavar%2Ffomajni","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcavar%2Ffomajni/lists"}