Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2
libreoffice-languagetool
JLanguageTool-1.4-package-dicts-separately.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File JLanguageTool-1.4-package-dicts-separately.diff of Package libreoffice-languagetool
--- build.xml +++ build.xml @@ -438,113 +438,62 @@ <copy file="${resource.dir}/segment.srx" todir="${dist.dir}/resource" /> <copy file="${resource.dir}/en/tagset.txt" todir="${dist.dir}/resource/en" /> - <copy file="${resource.dir}/en/english.dict" todir="${dist.dir}/resource/en" /> - <copy file="${resource.dir}/en/english.info" todir="${dist.dir}/resource/en" /> - <copy file="${resource.dir}/en/english_synth.dict" todir="${dist.dir}/resource/en" /> - <copy file="${resource.dir}/en/english_synth.info" todir="${dist.dir}/resource/en" /> <copy file="${resource.dir}/en/english_tags.txt" todir="${dist.dir}/resource/en" /> <copy file="${resource.dir}/en/disambiguation.xml" todir="${dist.dir}/resource/en" /> <copy file="${resource.dir}/en/compounds.txt" todir="${dist.dir}/resource/en" /> <copy file="${resource.dir}/eo/etikedoj.txt" todir="${dist.dir}/resource/eo" /> - <copy file="${resource.dir}/it/italian.dict" todir="${dist.dir}/resource/it" /> - <copy file="${resource.dir}/it/italian.info" todir="${dist.dir}/resource/it" /> <copy file="${resource.dir}/it/readme-morph-it.txt" todir="${dist.dir}/resource/it" /> - <copy file="${resource.dir}/fr/french.dict" todir="${dist.dir}/resource/fr" /> - <copy file="${resource.dir}/fr/french.info" todir="${dist.dir}/resource/fr" /> <copy file="${resource.dir}/fr/README_lexique.txt" todir="${dist.dir}/resource/fr" /> <copy file="${resource.dir}/fr/tagset.LT.txt" todir="${dist.dir}/resource/fr" /> <copy file="${resource.dir}/fr/multiwords.txt" todir="${dist.dir}/resource/fr" /> <copy file="${resource.dir}/fr/disambiguation.xml" todir="${dist.dir}/resource/fr" /> - <copy file="${resource.dir}/gl/galician.dict" todir="${dist.dir}/resource/gl" /> - <copy file="${resource.dir}/gl/galician.info" todir="${dist.dir}/resource/gl" /> <copy file="${resource.dir}/gl/README" todir="${dist.dir}/resource/gl" /> - <copy file="${resource.dir}/es/spanish.dict" todir="${dist.dir}/resource/es" /> - <copy file="${resource.dir}/es/spanish.info" todir="${dist.dir}/resource/es" /> <copy file="${resource.dir}/es/etiquetas-eagles.txt" todir="${dist.dir}/resource/es" /> - <copy file="${resource.dir}/es/spanish_synth.dict" todir="${dist.dir}/resource/es" /> - <copy file="${resource.dir}/es/spanish_synth.info" todir="${dist.dir}/resource/es" /> <copy file="${resource.dir}/es/spanish_tags.txt" todir="${dist.dir}/resource/es" /> <copy file="${resource.dir}/es/disambiguation.xml" todir="${dist.dir}/resource/es" /> <copy file="${resource.dir}/es/README" todir="${dist.dir}/resource/es" /> <copy file="${resource.dir}/da/danish_tags.txt" todir="${dist.dir}/resource/da" /> - <copy file="${resource.dir}/da/danish.dict" todir="${dist.dir}/resource/da" /> - <copy file="${resource.dir}/da/danish.info" todir="${dist.dir}/resource/da" /> - <copy file="${resource.dir}/de/german.dict" todir="${dist.dir}/resource/de" /> - <copy file="${resource.dir}/de/german.info" todir="${dist.dir}/resource/de" /> <copy file="${resource.dir}/de/compounds.txt" todir="${dist.dir}/resource/de" /> <copy file="${resource.dir}/de/added.txt" todir="${dist.dir}/resource/de" /> <copy file="${resource.dir}/de/tagset.txt" todir="${dist.dir}/resource/de" /> - <copy file="${resource.dir}/pl/polish.dict" todir="${dist.dir}/resource/pl" /> - <copy file="${resource.dir}/pl/polish.info" todir="${dist.dir}/resource/pl" /> - <copy file="${resource.dir}/pl/polish_synth.dict" todir="${dist.dir}/resource/pl" /> - <copy file="${resource.dir}/pl/polish_synth.info" todir="${dist.dir}/resource/pl" /> <copy file="${resource.dir}/pl/polish_tags.txt" todir="${dist.dir}/resource/pl" /> <copy file="${resource.dir}/pl/compounds.txt" todir="${dist.dir}/resource/pl" /> <copy file="${resource.dir}/pl/multiwords.txt" todir="${dist.dir}/resource/pl" /> <copy file="${resource.dir}/pl/disambiguation.xml" todir="${dist.dir}/resource/pl" /> - <copy file="${resource.dir}/nl/dutch.dict" todir="${dist.dir}/resource/nl" /> - <copy file="${resource.dir}/nl/dutch.info" todir="${dist.dir}/resource/nl" /> - <copy file="${resource.dir}/nl/dutch_synth.dict" todir="${dist.dir}/resource/nl" /> - <copy file="${resource.dir}/nl/dutch_synth.info" todir="${dist.dir}/resource/nl" /> <copy file="${resource.dir}/nl/dutch_tags.txt" todir="${dist.dir}/resource/nl" /> <copy file="${resource.dir}/nl/disambiguation.xml" todir="${dist.dir}/resource/nl" /> - <copy file="${resource.dir}/sv/swedish.info" todir="${dist.dir}/resource/sv" /> - <copy file="${resource.dir}/sv/swedish.dict" todir="${dist.dir}/resource/sv" /> <copy file="${resource.dir}/sv/compounds.txt" todir="${dist.dir}/resource/sv" /> - <copy file="${resource.dir}/uk/ukrainian.dict" todir="${dist.dir}/resource/uk" /> - - <copy file="${resource.dir}/ru/russian.dict" todir="${dist.dir}/resource/ru" /> - <copy file="${resource.dir}/ru/russian.info" todir="${dist.dir}/resource/ru" /> <copy file="${resource.dir}/ru/russian_tags.txt" todir="${dist.dir}/resource/ru" /> - <copy file="${resource.dir}/ru/russian_synth.dict" todir="${dist.dir}/resource/ru" /> - <copy file="${resource.dir}/ru/russian_synth.info" todir="${dist.dir}/resource/ru" /> <copy file="${resource.dir}/ru/tags_russian.txt" todir="${dist.dir}/resource/ru" /> <copy file="${resource.dir}/ru/compounds.txt" todir="${dist.dir}/resource/ru" /> <copy file="${resource.dir}/ru/disambiguation.xml" todir="${dist.dir}/resource/ru" /> - <copy file="${resource.dir}/ro/romanian.dict" todir="${dist.dir}/resource/ro" /> - <copy file="${resource.dir}/ro/romanian.info" todir="${dist.dir}/resource/ro" /> - <copy file="${resource.dir}/ro/romanian_synth.dict" todir="${dist.dir}/resource/ro" /> - <copy file="${resource.dir}/ro/romanian_synth.info" todir="${dist.dir}/resource/ro" /> <copy file="${resource.dir}/ro/romanian_tags.txt" todir="${dist.dir}/resource/ro" /> <copy file="${resource.dir}/ro/disambiguation.xml" todir="${dist.dir}/resource/ro" /> <copy file="${resource.dir}/ro/compounds.txt" todir="${dist.dir}/resource/ro" /> - <copy file="${resource.dir}/sk/slovak.dict" todir="${dist.dir}/resource/sk" /> - <copy file="${resource.dir}/sk/slovak.info" todir="${dist.dir}/resource/sk" /> <copy file="${resource.dir}/sk/compounds.txt" todir="${dist.dir}/resource/sk" /> <copy file="${resource.dir}/sk/README" todir="${dist.dir}/resource/sk" /> - <copy file="${resource.dir}/sk/slovak_synth.dict" todir="${dist.dir}/resource/sk" /> - <copy file="${resource.dir}/sk/slovak_synth.info" todir="${dist.dir}/resource/sk" /> <copy file="${resource.dir}/sk/slovak_tags.txt" todir="${dist.dir}/resource/sk" /> - <copy file="${resource.dir}/ml/malayalam.dict" todir="${dist.dir}/resource/ml" /> - <copy file="${resource.dir}/ml/malayalam.info" todir="${dist.dir}/resource/ml" /> - <copy file="${resource.dir}/km/khmer.dict" todir="${dist.dir}/resource/km" /> - <copy file="${resource.dir}/km/khmer.info" todir="${dist.dir}/resource/km" /> <copy file="${resource.dir}/km/khmertags.txt" todir="${dist.dir}/resource/km" /> <copy file="${resource.dir}/km/tagset.txt" todir="${dist.dir}/resource/km" /> <copy file="${resource.dir}/km/disambiguation.xml" todir="${dist.dir}/resource/km" /> - <copy file="${resource.dir}/ca/catalan_synth.dict" todir="${dist.dir}/resource/ca" /> - <copy file="${resource.dir}/ca/catalan_tags.txt" todir="${dist.dir}/resource/ca" /> - <copy file="${resource.dir}/ca/catalan.dict" todir="${dist.dir}/resource/ca" /> - <copy file="${resource.dir}/ca/catalan.info" todir="${dist.dir}/resource/ca" /> <copy file="${resource.dir}/ca/README" todir="${dist.dir}/resource/ca" /> - <copy file="${resource.dir}/xx/dummy.dict" tofile="${dist.dir}/resource/cs/czech.dict" /> <copy todir="${dist.dir}/rules"> <fileset dir="src/rules" excludes="CVS" /> </copy> --- src/java/de/danielnaber/languagetool/openoffice/Main.java +++ src/java/de/danielnaber/languagetool/openoffice/Main.java @@ -23,6 +23,7 @@ * * @author Marcin MiĆkowski */ +import java.io.IOException; import java.io.File; import java.util.ArrayList; import java.util.Arrays; @@ -481,9 +482,18 @@ */ @Override public final boolean hasLocale(final Locale locale) { + List<String> dummyList = new ArrayList<String>(); try { for (final Language element : Language.LANGUAGES) { - if (element.getShortName().equals(locale.Language)) { + // FIXME: dirty hack that checks whether the dictionary is really installed + // it is better to have dictionaries in optional packages + boolean dictionaryExists = true; + try { + element.getTagger().tag(dummyList); + } catch (IOException e) { + dictionaryExists = false; + } + if (dictionaryExists && element.getShortName().equals(locale.Language)) { return true; } } --- src/java/de/danielnaber/languagetool/databroker/DefaultResourceDataBroker.java.old 2011-08-30 16:34:02.000000000 +0200 +++ src/java/de/danielnaber/languagetool/databroker/DefaultResourceDataBroker.java 2011-08-31 17:23:08.000000000 +0200 @@ -138,7 +138,6 @@ public class DefaultResourceDataBroker i public InputStream getFromResourceDirAsStream(final String path) { final String completePath = this.getCompleteResourceUrl(path); final InputStream resourceAsStream = ResourceDataBroker.class.getResourceAsStream(completePath); - assertNotNull(resourceAsStream, path, completePath); return resourceAsStream; } @@ -158,7 +157,6 @@ public class DefaultResourceDataBroker i public URL getFromResourceDirAsUrl(final String path) { final String completePath = this.getCompleteResourceUrl(path); final URL resource = ResourceDataBroker.class.getResource(completePath); - assertNotNull(resource, path, completePath); return getFixedJarURL(resource); } @@ -205,7 +203,6 @@ public class DefaultResourceDataBroker i public InputStream getFromRulesDirAsStream(final String path) { final String completePath = this.getCompleteRulesUrl(path); final InputStream resourceAsStream = ResourceDataBroker.class.getResourceAsStream(completePath); - assertNotNull(resourceAsStream, path, completePath); return resourceAsStream; } @@ -224,7 +221,6 @@ public class DefaultResourceDataBroker i public URL getFromRulesDirAsUrl(final String path) { final String completePath = this.getCompleteRulesUrl(path); final URL resource = ResourceDataBroker.class.getResource(completePath); - assertNotNull(resource, path, completePath); return getFixedJarURL(resource); } --- src/java/de/danielnaber/languagetool/tagging/BaseTagger.java +++ src/java/de/danielnaber/languagetool/tagging/BaseTagger.java @@ -62,6 +62,9 @@ // caching IStemmer instance - lazy init if (dictLookup == null) { final URL url = this.getClass().getResource(getFileName()); + if (url == null) { + throw new IOException("Did not detect the dictonary file"); + } dictLookup = new DictionaryLookup(Dictionary.read(url)); } --- src/java/de/danielnaber/languagetool/tagging/cs/CzechTagger.java +++ src/java/de/danielnaber/languagetool/tagging/cs/CzechTagger.java @@ -61,6 +61,9 @@ // caching Lametyzator instance - lazy init if (morfologik == null) { final URL url = JLanguageTool.getDataBroker().getFromResourceDirAsUrl(RESOURCE_FILENAME); + if (url == null) { + throw new IOException("Did not detect the dictonary file"); + } morfologik = new DictionaryLookup(Dictionary.read(url)); } --- src/java/de/danielnaber/languagetool/tagging/de/GermanTagger.java +++ src/java/de/danielnaber/languagetool/tagging/de/GermanTagger.java @@ -76,6 +76,9 @@ // caching Lametyzator instance - lazy init if (morfologik == null) { final URL url = JLanguageTool.getDataBroker().getFromResourceDirAsUrl(DICT_FILENAME); + if (url == null) { + throw new IOException("Did not detect the dictonary file"); + } morfologik = new DictionaryLookup(Dictionary.read(url)); } if (manualTagger == null) { --- src/java/de/danielnaber/languagetool/tagging/pl/PolishTagger.java +++ src/java/de/danielnaber/languagetool/tagging/pl/PolishTagger.java @@ -61,6 +61,9 @@ // caching Lametyzator instance - lazy init if (morfologik == null) { final URL url = JLanguageTool.getDataBroker().getFromResourceDirAsUrl(RESOURCE_FILENAME); + if (url == null) { + throw new IOException("Did not detect the dictonary file"); + } morfologik = new DictionaryLookup(Dictionary.read(url)); } --- src/java/de/danielnaber/languagetool/tagging/ro/RomanianTagger.java +++ src/java/de/danielnaber/languagetool/tagging/ro/RomanianTagger.java @@ -72,6 +72,9 @@ // caching Lametyzator instance - lazy init if (morfologik == null) { final URL url = JLanguageTool.getDataBroker().getFromResourceDirAsUrl(RESOURCE_FILENAME); + if (url == null) { + throw new IOException("Did not detect the dictonary file"); + } morfologik = new DictionaryLookup(Dictionary.read(url)); } --- src/java/de/danielnaber/languagetool/tagging/uk/UkrainianMyspellTagger.java +++ src/java/de/danielnaber/languagetool/tagging/uk/UkrainianMyspellTagger.java @@ -63,6 +63,9 @@ if (wordsToPos == null) { wordsToPos = new HashMap<String, String[]>(); final InputStream resourceFile = JLanguageTool.getDataBroker().getFromResourceDirAsStream(RESOURCE_FILENAME); + if (resourceFile == null) { + throw new IOException("Did not detect the dictonary file"); + } // System.err.println("reading dict: " + resourceFile); final BufferedReader input = new BufferedReader(new InputStreamReader(
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor