thomas-joiner / hunspellbridj Goto Github PK
View Code? Open in Web Editor NEWThis library provides an API to interface with Hunspell using BridJ.
License: GNU Lesser General Public License v3.0
This library provides an API to interface with Hunspell using BridJ.
License: GNU Lesser General Public License v3.0
I need to make HunspellBridJ working under OSX 10.9. Could you give me instructions on how to build the library for OSX?
I copied the one from HunspellJNA to /darwin_x64/libhunspell.dylib, it seems it is not compatible with HunspellBridJ.
Add support for the add_dic method.
It looks like most of the library binaries haven't been updated in 3 years.
This isn't an issue, more a discussion for further improvements.
The native hunspell implemenation expects a patsh to physically existing dictionary files.
This is quite annoying if u want distribute your software, cause you have to ensure the dictionaries are available there.
Today i crumbled accross the chromium hunspell implementation which is based on the original one with some documented changes.
The interesting part is:
Change the input params of the constructors to receive a BDICTReader instead of a file path.
I don't know the exact behavior or implementation but shipping your Java API with this implementation and with their provided .bdic files would be a great benefit in my opinion.
I am wondering what type of license this is released under.
Does anyone know?
I am trying to use this library in a server code, and I hope that I can create an instance of Hunspell
class once and use concurrently from different threads. Is this possible? Is it thread-safe? I suppose it is expensive to create Hunspell
on each request...
hi i'v tried doing it for my self but with no luck, if you could do this it will be great
I can upgrade the hunspell lib to v.1.4.x, but with the 1.5.x I have got errors for this test:
Running com.atlascopco.hunspell.HunspellTest
error: /home/totha/work/HunspellBridJ/target/test-classes/test.aff: cannot open
error: /home/totha/work/HunspellBridJ/target/test-classes/test.aff: cannot open
Tests run: 37, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.2 sec <<< FAILURE!
testSuggestions(com.atlascopco.hunspell.HunspellTest) Time elapsed: 0.591 sec <<< FAILURE!
java.lang.AssertionError:
Expected: a collection containing "supercilious"
got: <[]>
at org.junit.Assert.assertThat(Assert.java:780)
at org.junit.Assert.assertThat(Assert.java:738)
at com.atlascopco.hunspell.HunspellTest.testSuggestions(HunspellTest.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Results :
Failed tests: testSuggestions(com.atlascopco.hunspell.HunspellTest): (..)
I have tried install with skipped tests, but it doesn't work for me.
I have updated my hunspell linux-x64 library to v1.4.2, but the result .so file is much bigger (9x-10x times), than the previous one (it's also true, when I build the user v1.3.4.
How do you build the native hunspell for smaller library size?
A description or a build script could be useful about this - because the hunspell has been actively developed nowadays :)
Dear Thomas,
Could you please state the license for your software?
Kind regards, Boris Smidt
I've written a SonarQube plugin that uses HunspellBridJ to flag spelling mistake violations. Everything runs fine when I run my tests locally. However, when I deploy the plugin it fails to find the HunspellLibrary class. I am sure the real error is being masked. This probably has more to do with SonarQube and it's classloader than HunspellBridJ, but I'm not too familiar with JNA to be able to pinpoint what exactly.
Caused by: java.lang.RuntimeException: Failed to register class com.atlascopco.hunspell.HunspellLibrary
at org.bridj.BridJ.register(BridJ.java:194)
at com.atlascopco.hunspell.HunspellLibrary.(HunspellLibrary.java:24)
... 94 more
Caused by: java.lang.ClassNotFoundException: com.atlascopco.hunspell.HunspellLibrary
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.bridj.BridJ.register(BridJ.java:191)
... 95 more
It looks like the library does not currently support unicode strings. For example, the German word for cheese "Käse" is marked as incorrectly spelled.
The spell method of class Hunspell uses pointerToCString internally to convert the method parameter "word".
Can this be changed to pointerToWideCString easily or does the native code only support ASCII characters?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.