Hello community, here is the log from the commit of package libvoikko for openSUSE:Factory checked in at 2019-11-06 15:14:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libvoikko (Old) and /work/SRC/openSUSE:Factory/.libvoikko.new.2990 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libvoikko" Wed Nov 6 15:14:50 2019 rev:33 rq:744648 version:4.3 Changes: -------- --- /work/SRC/openSUSE:Factory/libvoikko/libvoikko.changes 2019-03-13 09:05:14.623448585 +0100 +++ /work/SRC/openSUSE:Factory/.libvoikko.new.2990/libvoikko.changes 2019-11-06 15:14:51.677099896 +0100 @@ -1,0 +2,9 @@ +Thu Oct 31 11:32:09 UTC 2019 - Timo Jyrinki <[email protected]> + +- Update to version 4.3 + * New API function voikkoGetAttributeValues to list possible values for an analysis attribute. + * Improved spelling correction for Finnish words containing a hyphen. + * Improvements for Common Lisp interface. + * Fix compilation of JavaScript port on MacOS and with latest Emscripten. + +------------------------------------------------------------------- Old: ---- libvoikko-4.2.tar.gz libvoikko-4.2.tar.gz.asc New: ---- libvoikko-4.3.tar.gz libvoikko-4.3.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libvoikko.spec ++++++ --- /var/tmp/diff_new_pack.XriF9i/_old 2019-11-06 15:14:52.285100495 +0100 +++ /var/tmp/diff_new_pack.XriF9i/_new 2019-11-06 15:14:52.293100503 +0100 @@ -17,7 +17,7 @@ Name: libvoikko -Version: 4.2 +Version: 4.3 Release: 0 Summary: Library of free natural language processing tools License: GPL-2.0-or-later ++++++ libvoikko-4.2.tar.gz -> libvoikko-4.3.tar.gz ++++++ ++++ 1727 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/README new/libvoikko-4.3/README --- old/libvoikko-4.2/README 2018-10-09 21:06:53.000000000 +0200 +++ new/libvoikko-4.3/README 2019-10-17 16:22:44.000000000 +0200 @@ -183,7 +183,7 @@ Authors ======= -2006 - 2018 Harri Pitkänen ([email protected]) +2006 - 2019 Harri Pitkänen ([email protected]) * Maintainer, core library developer. 2006 Nemanja Trifunovic * Author of UTF8 utility module. @@ -194,4 +194,4 @@ Website ======= -http://voikko.puimula.org +https://voikko.puimula.org diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/cl/analyze.lisp new/libvoikko-4.3/cl/analyze.lisp --- old/libvoikko-4.2/cl/analyze.lisp 2012-06-28 20:57:59.000000000 +0200 +++ new/libvoikko-4.3/cl/analyze.lisp 2019-07-09 21:42:38.000000000 +0200 @@ -1,6 +1,6 @@ ;;;; A Common Lisp interface for libvoikko ;; -;; Copyright (C) 2011-2012 Teemu Likonen <[email protected]> +;; Copyright (C) 2011, 2012, 2019 Teemu Likonen <[email protected]> ;; ;; The contents of this file are subject to the Mozilla Public License Version ;; 1.1 (the "License"); you may not use this file except in compliance with @@ -77,6 +77,8 @@ INSTANCE must be an active Voikko instance, if not, a condition of type NOT-ACTIVE-INSTANCE-ERROR is signaled." + (error-if-not-active-instance instance) + (check-type word string) (let ((analysis (analyze-word instance word))) (when (and (mor-analysis-p analysis) (activep analysis)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/cl/general.lisp new/libvoikko-4.3/cl/general.lisp --- old/libvoikko-4.2/cl/general.lisp 2013-07-30 22:09:24.000000000 +0200 +++ new/libvoikko-4.3/cl/general.lisp 2019-07-09 21:42:38.000000000 +0200 @@ -1,6 +1,6 @@ ;;;; A Common Lisp interface for libvoikko ;; -;; Copyright (C) 2011-2012 Teemu Likonen <[email protected]> +;; Copyright (C) 2011, 2012, 2019 Teemu Likonen <[email protected]> ;; ;; The contents of this file are subject to the Mozilla Public License Version ;; 1.1 (the "License"); you may not use this file except in compliance with @@ -96,24 +96,31 @@ (defmethod free-foreign-resource ((object instance)) (foreign-funcall "voikkoTerminate" :pointer (address object) :void)) -(defun initialize (&key (language "fi_FI")) - "Initialize a Voikko instance for LANGUAGE. Return an object of type -INSTANCE which can then be used with other Voikko functions. The -instance must be closed with TERMINATE function after use. See also the -macro WITH-INSTANCE which automatically initializes and terminates a -Voikko instance. +(defun initialize (&key (language "fi_FI") path) + "Initialize a Voikko instance for LANGUAGE (string). Language +dictionaries are searched from Libvoikko's default locations and +additionally from PATH (string). + +Return an object of type INSTANCE which can then be used with other +Voikko functions. The instance must be closed with TERMINATE function +after use. See also the macro WITH-INSTANCE which automatically +initializes and terminates a Voikko instance. If instance couldn't be initialized a condition of type INITIALIZE-ERROR is signaled. In that case there is an active restart called CHANGE-LANGUAGE. It can be invoked with a new language string as its argument. The restart retries the initialize process." + (check-type language string) + (check-type path (or string null)) (with-foreign-object (error :pointer) (loop (restart-case (let ((address (foreign-funcall "voikkoInit" :pointer error :string language - :pointer (null-pointer) + :string (if (null path) + (null-pointer) + path) :pointer))) (if (and (pointerp address) @@ -136,14 +143,94 @@ (assert (instancep instance) nil "The object is not a Voikko instance.") (free-foreign-resource instance)) -(defmacro with-instance ((variable &key (language "fi_FI")) &body body) - "Initialize a Voikko instance for LANGUAGE, bind VARIABLE to the -INSTANCE object and execute BODY forms. Finally, terminate the instance -and return the values of the last body form." +(defmacro with-instance ((variable &key (language "fi_FI") path) + &body body) + "Initialize a Voikko instance using INITIALIZE function (with its +keyword arguments), bind VARIABLE to the INSTANCE object and execute +BODY forms. Finally, terminate the instance with TERMINATE function and +return the values of the last body form." (let ((instance (gensym "INSTANCE"))) - `(let* ((,instance (initialize :language ,language)) + `(let* ((,instance (initialize :language ,language + :path ,path)) (,variable ,instance)) (declare (ignorable ,variable)) (unwind-protect (progn ,@body) (terminate ,instance))))) + +(defun list-dictionaries (&optional path) + "Get a list of available dictionaries from Libvoikko's default search +paths and additionally from PATH (string). Return a list which contains +one association list for each dictionary. The association list has the +following keys (keyword symbols): :LANGUAGE, :SCRIPT, :VARIANT and +:DESCRIPTION. Each key's value is a string." + (check-type path (or string null)) + (let ((dicts-ptr (foreign-funcall "voikko_list_dicts" + :string (if (null path) + (null-pointer) + path) + :pointer))) + (when (proper-pointer-p dicts-ptr) + (unwind-protect + (loop :for i :upfrom 0 + :for dict-ptr := (mem-aref dicts-ptr :pointer i) + :while (proper-pointer-p dict-ptr) + :collect + (list (cons :language (foreign-funcall + "voikko_dict_language" + :pointer dict-ptr :string)) + (cons :script (foreign-funcall + "voikko_dict_script" + :pointer dict-ptr :string)) + (cons :variant (foreign-funcall + "voikko_dict_variant" + :pointer dict-ptr :string)) + (cons :description (foreign-funcall + "voikko_dict_description" + :pointer dict-ptr :string)))) + (foreign-funcall "voikko_free_dicts" :pointer dicts-ptr :void))))) + +(defun list-supported-spelling-languages (&optional path) + "Return a list of language codes (string) representing the languages +for which at least one dictionary is available for spell checking." + (check-type path (or string null)) + (let ((ptr (foreign-funcall "voikkoListSupportedSpellingLanguages" + :string (if (null path) + (null-pointer) + path) + :pointer))) + (when (proper-pointer-p ptr) + (loop :for i :upfrom 0 + :for lang := (mem-aref ptr :string i) + :while (stringp lang) + :collect lang)))) + +(defun list-supported-hyphenation-languages (&optional path) + "Return a list of language codes (string) representing the languages +for which at least one dictionary is available for hyphenation." + (check-type path (or string null)) + (let ((ptr (foreign-funcall "voikkoListSupportedHyphenationLanguages" + :string (if (null path) + (null-pointer) + path) + :pointer))) + (when (proper-pointer-p ptr) + (loop :for i :upfrom 0 + :for lang := (mem-aref ptr :string i) + :while (stringp lang) + :collect lang)))) + +(defun list-supported-grammar-checking-languages (&optional path) + "Return a list of language codes (string) representing the languages +for which at least one dictionary is available for grammar checking." + (check-type path (or string null)) + (let ((ptr (foreign-funcall "voikkoListSupportedGrammarCheckingLanguages" + :string (if (null path) + (null-pointer) + path) + :pointer))) + (when (proper-pointer-p ptr) + (loop :for i :upfrom 0 + :for lang := (mem-aref ptr :string i) + :while (stringp lang) + :collect lang)))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/cl/packages.lisp new/libvoikko-4.3/cl/packages.lisp --- old/libvoikko-4.2/cl/packages.lisp 2013-07-30 22:09:24.000000000 +0200 +++ new/libvoikko-4.3/cl/packages.lisp 2019-07-11 20:18:04.000000000 +0200 @@ -4,7 +4,11 @@ (:use #:cl #:cffi) (:export #:instance #:activep #:initialize #:terminate #:with-instance #:spell #:suggest #:hyphenate #:version - #:set-option #:analyze #:split-word + #:insert-hyphens + #:set-option #:analyze #:split-word #:list-dictionaries + #:list-supported-spelling-languages + #:list-supported-hyphenation-languages + #:list-supported-grammar-checking-languages #:error-string #:voikko-error #:initialize-error #:internal-error diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/cl/spell.lisp new/libvoikko-4.3/cl/spell.lisp --- old/libvoikko-4.2/cl/spell.lisp 2012-06-28 20:57:59.000000000 +0200 +++ new/libvoikko-4.3/cl/spell.lisp 2019-07-11 20:18:04.000000000 +0200 @@ -1,6 +1,6 @@ ;;;; A Common Lisp interface for libvoikko ;; -;; Copyright (C) 2011-2012 Teemu Likonen <[email protected]> +;; Copyright (C) 2011, 2012, 2019 Teemu Likonen <[email protected]> ;; ;; The contents of this file are subject to the Mozilla Public License Version ;; 1.1 (the "License"); you may not use this file except in compliance with @@ -32,6 +32,7 @@ not, a condition of type NOT-ACTIVE-INSTANCE-ERROR is signaled." (error-if-not-active-instance instance) + (check-type word string) (let ((value (foreign-funcall "voikkoSpellCstr" :pointer (address instance) :string word @@ -57,6 +58,7 @@ NOT-ACTIVE-INSTANCE-ERROR is signaled." (error-if-not-active-instance instance) + (check-type word string) (let ((suggestions (foreign-funcall "voikkoSuggestCstr" :pointer (address instance) :string word @@ -87,6 +89,7 @@ NOT-ACTIVE-INSTANCE-ERROR is signaled." (error-if-not-active-instance instance) + (check-type word string) (let ((hyphenation (foreign-funcall "voikkoHyphenateCstr" :pointer (address instance) :string word @@ -119,6 +122,26 @@ (error 'hyphenation-error :string "Hyphenation error.")))) +(defun insert-hyphens (instance word &key (hyphen #\-) + allow-context-changes) + "Hyphenate WORD (string) by inserting HYPHEN (character) between each +syllable. If ALLOW-CONTEXT-CHANGES is non-nil hyphens are inserted even +if they alter the word in unhyphenated form. Return the hyphenated +word (string). + +INSTANCE must be an active Voikko instance, if not, a condition of type +NOT-ACTIVE-INSTANCE-ERROR is signaled." + + (error-if-not-active-instance instance) + (check-type word string) + (check-type hyphen character) + (foreign-funcall "voikkoInsertHyphensCstr" + :pointer (address instance) + :string word + :string (string hyphen) + :int (if allow-context-changes 1 0) + :string)) + (defun split-word (instance width word) "Split WORD in two and return the parts as a cons cell. The word is split at correct hyphenation points only. The WIDTH argument defines the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/configure.ac new/libvoikko-4.3/configure.ac --- old/libvoikko-4.2/configure.ac 2018-10-09 21:07:06.000000000 +0200 +++ new/libvoikko-4.3/configure.ac 2019-10-17 16:26:08.000000000 +0200 @@ -28,7 +28,7 @@ dnl General options for autoconf AC_PREREQ(2.62) -AC_INIT([libvoikko],[4.2],[[email protected]]) +AC_INIT([libvoikko],[4.3],[[email protected]]) LT_PREREQ([2.2.6]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/java/pom.xml new/libvoikko-4.3/java/pom.xml --- old/libvoikko-4.2/java/pom.xml 2018-02-28 18:55:04.000000000 +0100 +++ new/libvoikko-4.3/java/pom.xml 2019-09-24 20:43:26.000000000 +0200 @@ -5,11 +5,11 @@ <groupId>org.puimula.voikko</groupId> <artifactId>libvoikko</artifactId> - <version>4.2</version> + <version>4.3</version> <packaging>jar</packaging> <name>libvoikko</name> <description>Java API for libvoikko, library of free natural language processing tools</description> - <url>http://voikko.puimula.org</url> + <url>https://voikko.puimula.org</url> <licenses> <license> @@ -42,7 +42,7 @@ <organization> <name>Voikko developers</name> - <url>http://voikko.puimula.org</url> + <url>https://voikko.puimula.org</url> </organization> <properties> @@ -53,14 +53,21 @@ <dependency> <groupId>net.java.dev.jna</groupId> <artifactId>jna</artifactId> - <version>4.5.0</version> + <version>5.4.0</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> - <version>5.1.0</version> + <version>5.5.2</version> + <type>jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <version>5.5.2</version> <type>jar</type> <scope>test</scope> </dependency> @@ -71,7 +78,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>3.7.0</version> + <version>3.8.1</version> <configuration> <source>1.8</source> <target>1.8</target> @@ -79,19 +86,7 @@ </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> - <version>2.19.1</version> - <dependencies> - <dependency> - <groupId>org.junit.platform</groupId> - <artifactId>junit-platform-surefire-provider</artifactId> - <version>1.1.0</version> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-engine</artifactId> - <version>5.1.0</version> - </dependency> - </dependencies> + <version>2.22.2</version> </plugin> </plugins> </build> @@ -101,7 +96,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> - <version>3.0.0</version> + <version>3.1.1</version> <configuration> <sourceFileExcludes> <sourceFileExclude>org/puimula/libvoikko/ByteArray.java</sourceFileExclude> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/java/src/main/java/org/puimula/libvoikko/Libvoikko.java new/libvoikko-4.3/java/src/main/java/org/puimula/libvoikko/Libvoikko.java --- old/libvoikko-4.2/java/src/main/java/org/puimula/libvoikko/Libvoikko.java 2018-03-04 14:28:59.000000000 +0100 +++ new/libvoikko-4.3/java/src/main/java/org/puimula/libvoikko/Libvoikko.java 2019-09-28 11:45:05.000000000 +0200 @@ -113,4 +113,6 @@ public abstract int voikkoSetBooleanOption(VoikkoHandle handle, int option, int value); public abstract int voikkoSetIntegerOption(VoikkoHandle handle, int option, int value); + + public abstract Pointer voikkoGetAttributeValues(VoikkoHandle handle, byte[] attributeName); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/java/src/main/java/org/puimula/libvoikko/Voikko.java new/libvoikko-4.3/java/src/main/java/org/puimula/libvoikko/Voikko.java --- old/libvoikko-4.2/java/src/main/java/org/puimula/libvoikko/Voikko.java 2018-03-04 14:28:59.000000000 +0100 +++ new/libvoikko-4.3/java/src/main/java/org/puimula/libvoikko/Voikko.java 2019-09-28 11:52:27.000000000 +0200 @@ -78,11 +78,11 @@ for (String libName : LIBRARY_NAMES) { NativeLibrary nativeLibrary = tryLoadLibrary(libName); if (nativeLibrary != null) { - library = (Libvoikko) Native.loadLibrary(nativeLibrary.getFile().getPath(), Libvoikko.class); + library = (Libvoikko) Native.load(nativeLibrary.getFile().getPath(), Libvoikko.class); return library; } } - throw new UnsatisfiedLinkError("Could not load the native component of libvoikko. Please see http://voikko.puimula.org/java.html for more information."); + throw new UnsatisfiedLinkError("Could not load the native component of libvoikko. Please see https://voikko.puimula.org/java.html for more information."); } return library; } @@ -646,4 +646,28 @@ } } + /** + * Get list of possible values for an attribute + * @param attributeName name of the attribute + * @return A list of possible attribute values for attribute in morphological analysis or null if + * the attribute does not exist or it does not have a known finite set of possible values. + */ + public List<String> attributeValues(String attributeName) { + requireValidHandle(); + if (!isValidInput(attributeName)) { + return null; + } + Pointer cValues = getLib().voikkoGetAttributeValues(handle, s2n(attributeName)); + if (cValues == null) { + return null; + } + Pointer[] pointerArray = cValues.getPointerArray(0); + List<String> values = new ArrayList<String>(pointerArray.length); + for (Pointer cStr : pointerArray) { + values.add(stringFromPointer(cStr)); + } + getLib().voikkoFreeCstrArray(cValues); + return values; + } + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/java/src/test/java/org/puimula/libvoikko/VoikkoTest.java new/libvoikko-4.3/java/src/test/java/org/puimula/libvoikko/VoikkoTest.java --- old/libvoikko-4.2/java/src/test/java/org/puimula/libvoikko/VoikkoTest.java 2018-03-04 14:28:59.000000000 +0100 +++ new/libvoikko-4.3/java/src/test/java/org/puimula/libvoikko/VoikkoTest.java 2019-09-28 11:41:30.000000000 +0200 @@ -31,6 +31,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.fail; import java.util.Arrays; @@ -250,6 +251,26 @@ } @Test + public void attributeValuesForEnumeratedAttribute() { + List<String> values = voikko.attributeValues("NUMBER"); + assertEquals(2, values.size()); + assertTrue(values.contains("singular")); + assertTrue(values.contains("plural")); + } + + @Test + public void attributeValuesForNonEnumeratedAttribute() { + List<String> values = voikko.attributeValues("BASEFORM"); + assertNull(values); + } + + @Test + public void attributeValuesForUnknownAttribute() { + List<String> values = voikko.attributeValues("XYZ"); + assertNull(values); + } + + @Test public void sentences() { List<Sentence> sentences = voikko.sentences("Kissa ei ole koira. Koira ei ole kissa."); assertEquals(2, sentences.size()); @@ -267,6 +288,7 @@ assertEquals(" = ", voikko.getHyphenationPattern("vaa'an")); } + @SuppressWarnings("deprecation") // testing deprecated methods @Test public void hyphenate() { assertEquals("kis-sa", voikko.hyphenate("kissa")); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/m4/libtool.m4 new/libvoikko-4.3/m4/libtool.m4 --- old/libvoikko-4.2/m4/libtool.m4 2018-10-09 21:08:44.000000000 +0200 +++ new/libvoikko-4.3/m4/libtool.m4 2019-10-17 16:28:08.000000000 +0200 @@ -4063,7 +4063,8 @@ if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD + if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/python/libvoikko.py new/libvoikko-4.3/python/libvoikko.py --- old/libvoikko-4.2/python/libvoikko.py 2018-02-28 13:54:02.000000000 +0100 +++ new/libvoikko-4.3/python/libvoikko.py 2019-09-17 20:24:55.000000000 +0200 @@ -400,6 +400,9 @@ self.voikkoListSupportedGrammarCheckingLanguages.argtypes = [c_char_p] self.voikkoListSupportedGrammarCheckingLanguages.restype = POINTER(c_char_p) + + self.voikkoGetAttributeValues.argtypes = [c_void_p, c_char_p] + self.voikkoGetAttributeValues.restype = POINTER(c_char_p) self.voikkoGetVersion.argtypes = [] self.voikkoGetVersion.restype = c_char_p @@ -749,6 +752,22 @@ textLen = textLen - sentenceLen.value return result + def attributeValues(self, attributeName): + """Returns a list of possible attribute values for attribute in morphological analysis. + If the attribute does not exist or it does not have a known finite set of possible values returns None.""" + if not self.__isValidInput(attributeName): + return None + cValues = self.__lib.voikkoGetAttributeValues(self.__handle, _anyStringToUtf8(attributeName)) + if not bool(cValues): + return None + i = 0 + values = [] + while bool(cValues[i]): + values.append(unicode_str(cValues[i], "UTF-8")) + i = i + 1 + self.__lib.voikkoFreeCstrArray(cValues) + return values + def getHyphenationPattern(self, word): """Return a character pattern that describes the hyphenation of given word. ' ' = no hyphenation at this character, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/src/Makefile.am new/libvoikko-4.3/src/Makefile.am --- old/libvoikko-4.2/src/Makefile.am 2018-10-09 21:07:30.000000000 +0200 +++ new/libvoikko-4.3/src/Makefile.am 2019-10-17 16:27:03.000000000 +0200 @@ -78,8 +78,9 @@ grammar/FinnishRuleEngine/ParagraphCheck.cpp \ grammar/FinnishRuleEngine/SentenceCheck.cpp \ grammar/FinnishRuleEngine/SidesanaCheck.cpp \ + grammar/FinnishRuleEngine/RelativePronounCheck.cpp \ compatibility/interface.cpp -libvoikko_la_LDFLAGS = -no-undefined -version-info 16:0:15 @LIBLDFLAGSWIN@ +libvoikko_la_LDFLAGS = -no-undefined -version-info 17:0:16 @LIBLDFLAGSWIN@ pkginclude_HEADERS = voikko.h voikko_enums.h voikko_defines.h voikko_deprecated.h voikko_structs.h noinst_HEADERS = \ @@ -172,6 +173,7 @@ grammar/FinnishRuleEngine/ParagraphCheck.hpp \ grammar/FinnishRuleEngine/SentenceCheck.hpp \ grammar/FinnishRuleEngine/SidesanaCheck.hpp \ + grammar/FinnishRuleEngine/RelativePronounCheck.hpp \ grammar/FinnishRuleEngine/VfstAutocorrectCheck.hpp \ utf8/core.hpp \ utf8/checked.hpp \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/src/grammar/FinnishRuleEngine/RelativePronounCheck.cpp new/libvoikko-4.3/src/grammar/FinnishRuleEngine/RelativePronounCheck.cpp --- old/libvoikko-4.2/src/grammar/FinnishRuleEngine/RelativePronounCheck.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/libvoikko-4.3/src/grammar/FinnishRuleEngine/RelativePronounCheck.cpp 2019-07-09 21:42:38.000000000 +0200 @@ -0,0 +1,40 @@ +/* The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Libvoikko: Library of natural language processing tools. + * The Initial Developer of the Original Code is Harri Pitkänen <[email protected]>. + * Portions created by the Initial Developer are Copyright (C) 2019 + * the Initial Developer. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + *********************************************************************************/ + +#include "grammar/FinnishRuleEngine/RelativePronounCheck.hpp" +#include "grammar/error.hpp" + +using namespace std; + +namespace libvoikko { namespace grammar { namespace check { + +void RelativePronounCheck::check(voikko_options_t * options, const Sentence * sentence) { + // TODO +} + +} } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/src/grammar/FinnishRuleEngine/RelativePronounCheck.hpp new/libvoikko-4.3/src/grammar/FinnishRuleEngine/RelativePronounCheck.hpp --- old/libvoikko-4.2/src/grammar/FinnishRuleEngine/RelativePronounCheck.hpp 1970-01-01 01:00:00.000000000 +0100 +++ new/libvoikko-4.3/src/grammar/FinnishRuleEngine/RelativePronounCheck.hpp 2019-07-09 21:42:38.000000000 +0200 @@ -0,0 +1,45 @@ +/* The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Libvoikko: Library of natural language processing tools. + * The Initial Developer of the Original Code is Harri Pitkänen <[email protected]>. + * Portions created by the Initial Developer are Copyright (C) 2019 + * the Initial Developer. All Rights Reserved. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + *********************************************************************************/ + +#ifndef VOIKKO_GRAMMAR_CHECK_RELATIVE_PRONOUN_CHECK +#define VOIKKO_GRAMMAR_CHECK_RELATIVE_PRONOUN_CHECK + +#include "grammar/FinnishRuleEngine/SentenceCheck.hpp" + +namespace libvoikko { namespace grammar { namespace check { +/** + * Check for missing commas before relative pronouns "joka" and "mikä". + */ +class RelativePronounCheck : public SentenceCheck { + public: + void check(voikko_options_t * options, const Sentence * sentence); +}; + +} } } + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/src/grammar/FinnishRuleEngine.cpp new/libvoikko-4.3/src/grammar/FinnishRuleEngine.cpp --- old/libvoikko-4.2/src/grammar/FinnishRuleEngine.cpp 2017-03-08 19:30:29.000000000 +0100 +++ new/libvoikko-4.3/src/grammar/FinnishRuleEngine.cpp 2019-07-09 21:42:38.000000000 +0200 @@ -35,6 +35,7 @@ #include "grammar/FinnishRuleEngine/NegativeVerbCheck.hpp" #include "grammar/FinnishRuleEngine/CompoundVerbCheck.hpp" #include "grammar/FinnishRuleEngine/SidesanaCheck.hpp" +#include "grammar/FinnishRuleEngine/RelativePronounCheck.hpp" #ifdef HAVE_VFST #include "grammar/FinnishRuleEngine/VfstAutocorrectCheck.hpp" @@ -49,6 +50,7 @@ sentenceChecks.push_back(new check::NegativeVerbCheck()); sentenceChecks.push_back(new check::CompoundVerbCheck()); sentenceChecks.push_back(new check::SidesanaCheck()); + sentenceChecks.push_back(new check::RelativePronounCheck()); #ifdef HAVE_VFST if (voikkoOptions->dictionary.getGrammarBackend().getBackend() == "finnishVfst") { std::string autocorrFile = voikkoOptions->dictionary.getGrammarBackend().getPath() + "/autocorr.vfst"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/src/libvoikko.pc.in new/libvoikko-4.3/src/libvoikko.pc.in --- old/libvoikko-4.2/src/libvoikko.pc.in 2017-09-17 20:49:53.000000000 +0200 +++ new/libvoikko-4.3/src/libvoikko.pc.in 2019-07-09 21:42:38.000000000 +0200 @@ -5,7 +5,7 @@ Name: libvoikko Description: Library for language tools -URL: http://voikko.puimula.org +URL: https://voikko.puimula.org Version: @VERSION@ Libs: -L${libdir} -lvoikko Cflags: -I${includedir} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/src/morphology/Analyzer.cpp new/libvoikko-4.3/src/morphology/Analyzer.cpp --- old/libvoikko-4.2/src/morphology/Analyzer.cpp 2015-10-22 17:53:25.000000000 +0200 +++ new/libvoikko-4.3/src/morphology/Analyzer.cpp 2019-09-17 20:24:55.000000000 +0200 @@ -36,6 +36,11 @@ Analyzer::~Analyzer() { } +std::list<const wchar_t *> Analyzer::getAttributeValues(const char * attributeName) { + // Default implementation will handle all attributes as if their values cannot be enumerated. + return list<const wchar_t *>(); +} + void Analyzer::deleteAnalyses(list<Analysis *> * &analyses) { list<Analysis *>::iterator it = analyses->begin(); while (it != analyses->end()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/src/morphology/Analyzer.hpp new/libvoikko-4.3/src/morphology/Analyzer.hpp --- old/libvoikko-4.2/src/morphology/Analyzer.hpp 2015-10-20 17:02:53.000000000 +0200 +++ new/libvoikko-4.3/src/morphology/Analyzer.hpp 2019-09-17 20:24:55.000000000 +0200 @@ -46,6 +46,8 @@ virtual std::list<Analysis *> * analyze(const wchar_t * word, size_t wlen, bool fullMorphology) = 0; virtual std::list<Analysis *> * analyze(const char * word, bool fullMorphology) = 0; + virtual std::list<const wchar_t *> getAttributeValues(const char * attributeName); + virtual void terminate() = 0; virtual ~Analyzer(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/src/morphology/FinnishVfstAnalyzer.cpp new/libvoikko-4.3/src/morphology/FinnishVfstAnalyzer.cpp --- old/libvoikko-4.2/src/morphology/FinnishVfstAnalyzer.cpp 2018-02-27 18:30:15.000000000 +0100 +++ new/libvoikko-4.3/src/morphology/FinnishVfstAnalyzer.cpp 2019-09-17 20:24:55.000000000 +0200 @@ -1110,6 +1110,63 @@ return analysisList; } +static std::list<const wchar_t *> valuesFromMap(std::map<std::wstring, const wchar_t *> & map) { + list<const wchar_t *> values = list<const wchar_t *>(); + for (auto const &entry : map) { + values.push_back(entry.second); + } + return values; +} + +std::list<const wchar_t *> FinnishVfstAnalyzer::getAttributeValues(const char * attributeName) { + string attribute(attributeName); + if (attribute == "CLASS") { + return valuesFromMap(classMap); + } + if (attribute == "NUMBER") { + return valuesFromMap(numberMap); + } + if (attribute == "COMPARISON") { + return valuesFromMap(comparisonMap); + } + if (attribute == "FOCUS") { + return valuesFromMap(focusMap); + } + if (attribute == "TENSE") { + return valuesFromMap(tenseMap); + } + if (attribute == "SIJAMUOTO") { + return valuesFromMap(sijamuotoMap); + } + if (attribute == "MOOD") { + return valuesFromMap(moodMap); + } + if (attribute == "PERSON") { + return valuesFromMap(personMap); + } + if (attribute == "PARTICIPLE") { + return valuesFromMap(participleMap); + } + if (attribute == "NEGATIVE") { + return valuesFromMap(negativeMap); + } + if (attribute == "POSSESSIVE") { + return valuesFromMap(possessiveMap); + } + list<const wchar_t *> values = list<const wchar_t *>(); + if (attribute == "KYSYMYSLIITE" || attribute == "MALAGA_VAPAA_JALKIOSA" || + attribute == "POSSIBLE_GEOGRAPHICAL_NAME") { + values.push_back(L"true"); + return values; + } + if (attribute == "REQUIRE_FOLLOWING_VERB") { + values.push_back(L"A-infinitive"); + values.push_back(L"MA-infinitive"); + return values; + } + return values; +} + void FinnishVfstAnalyzer::terminate() { delete[] outputBuffer; delete configuration; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/src/morphology/FinnishVfstAnalyzer.hpp new/libvoikko-4.3/src/morphology/FinnishVfstAnalyzer.hpp --- old/libvoikko-4.2/src/morphology/FinnishVfstAnalyzer.hpp 2018-04-11 21:29:22.000000000 +0200 +++ new/libvoikko-4.3/src/morphology/FinnishVfstAnalyzer.hpp 2019-09-17 20:24:55.000000000 +0200 @@ -46,6 +46,7 @@ explicit FinnishVfstAnalyzer(const std::string & directoryName); std::list<Analysis *> * analyze(const wchar_t * word, size_t wlen, bool fullMorphology); std::list<Analysis *> * analyze(const char * word, bool fullMorphology); + std::list<const wchar_t *> getAttributeValues(const char * attributeName); void terminate(); private: fst::UnweightedTransducer * transducer; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/src/morphology/interface.cpp new/libvoikko-4.3/src/morphology/interface.cpp --- old/libvoikko-4.2/src/morphology/interface.cpp 2016-02-06 16:11:22.000000000 +0100 +++ new/libvoikko-4.3/src/morphology/interface.cpp 2019-09-17 20:24:55.000000000 +0200 @@ -111,4 +111,21 @@ delete[] analysis_value; } +VOIKKOEXPORT char ** voikkoGetAttributeValues(voikko_options_t * options, const char * attributeName) { + if (!attributeName) { + return nullptr; + } + std::list<const wchar_t *> attributeValues = options->morAnalyzer->getAttributeValues(attributeName); + if (attributeValues.empty()) { + return nullptr; + } + char ** values = new char*[attributeValues.size() + 1]; + size_t i = 0; + for (const wchar_t * s : attributeValues) { + values[i++] = utils::StringUtils::utf8FromUcs4(s); + } + values[i] = nullptr; + return values; +} + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/src/spellchecker/suggestion/SuggestionGeneratorSplitWord.cpp new/libvoikko-4.3/src/spellchecker/suggestion/SuggestionGeneratorSplitWord.cpp --- old/libvoikko-4.2/src/spellchecker/suggestion/SuggestionGeneratorSplitWord.cpp 2017-01-11 18:05:22.000000000 +0100 +++ new/libvoikko-4.3/src/spellchecker/suggestion/SuggestionGeneratorSplitWord.cpp 2019-07-10 18:58:29.000000000 +0200 @@ -77,15 +77,16 @@ or after the first character of part2. Do not suggest splitting immediately before or after a hyphen either. */ if (s->getWord()[splitind-2] == L'-' || s->getWord()[splitind-1] == L'-' || - s->getWord()[splitind] == L'-' || s->getWord()[splitind+1] == L'-') continue; + s->getWord()[splitind+1] == L'-') continue; + size_t stripLead2 = (s->getWord()[splitind] == L'-') ? 1 : 0; // "suuntaa-antava" -> "suuntaa antava" part1[splitind] = L'\0'; if (getResultForPart1(s, part1, splitind, prio_total)) { wchar_t * suggestion = new wchar_t[s->getWordLength() + 2]; size_t w2start = splitind + 1; - size_t w2len = s->getWordLength() - splitind; - wcsncpy(suggestion + w2start, s->getWord() + splitind, w2len + 1); + size_t w2len = s->getWordLength() - splitind - stripLead2; + wcsncpy(suggestion + w2start, s->getWord() + splitind + stripLead2, w2len + 1); bool part2Result = spellOk(s, suggestion + w2start, w2len, prio_part); - prio_total += prio_part; + prio_total = (prio_total + prio_part) * (1 + stripLead2 * 5); if (part2Result) { wcsncpy(suggestion, part1, splitind); suggestion[splitind] = L' '; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/src/tools/voikkovfstc.cpp new/libvoikko-4.3/src/tools/voikkovfstc.cpp --- old/libvoikko-4.2/src/tools/voikkovfstc.cpp 2016-02-06 12:57:38.000000000 +0100 +++ new/libvoikko-4.3/src/tools/voikkovfstc.cpp 2019-07-09 21:42:38.000000000 +0200 @@ -10,7 +10,7 @@ * * The Original Code is Libvoikko: Library of natural language processing tools. * The Initial Developer of the Original Code is Harri Pitkänen <[email protected]>. - * Portions created by the Initial Developer are Copyright (C) 2012 - 2014 + * Portions created by the Initial Developer are Copyright (C) 2012 - 2019 * the Initial Developer. All Rights Reserved. * * Alternatively, the contents of this file may be used under the terms of @@ -443,6 +443,10 @@ cout << "Overflow cells: " << overflowCells << endl; ofstream transducerFile(outputFile.c_str(), ios::out | ios::binary); + if (!transducerFile.is_open()) { + cerr << "ERROR: cannot open output file for writing: " << outputFile << endl; + return 1; + } // Write header // Following two 4 byte integers can be used to determine the file type and byte order diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/src/voikko.h new/libvoikko-4.3/src/voikko.h --- old/libvoikko-4.2/src/voikko.h 2018-02-27 21:49:25.000000000 +0100 +++ new/libvoikko-4.3/src/voikko.h 2019-09-01 17:45:55.000000000 +0200 @@ -468,6 +468,16 @@ */ void voikko_free_mor_analysis_value_cstr(char * analysis_value); + +/** + * Get list of possible attribute values in morphological analysis. + * @param handle voikko instance + * @param attributeName name of morphological analysis attribute + * @return a list of possible attribute values for attribute in morphological analysis. + * If the attribute does not exist or it does not have a known finite set of possible values returns null. + */ +char ** voikkoGetAttributeValues(struct VoikkoHandle * handle, const char * attributeName); + #ifndef VOIKKO_NO_DEPRECATED_API #include "voikko_deprecated.h" #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libvoikko-4.2/test/libvoikkoTest.py new/libvoikko-4.3/test/libvoikkoTest.py --- old/libvoikko-4.2/test/libvoikkoTest.py 2018-02-28 13:51:36.000000000 +0100 +++ new/libvoikko-4.3/test/libvoikkoTest.py 2019-09-01 18:14:38.000000000 +0200 @@ -189,6 +189,20 @@ self.assertEqual(u"Koira ei ole kissa.", sentences[1].sentenceText) self.assertEqual(Sentence.NONE, sentences[1].nextStartType) + def testAttributeValuesForEnumeratedAttribute(self): + values = self.voikko.attributeValues(u"NUMBER") + self.assertEqual(2, len(values)) + self.assertTrue("singular" in values) + self.assertTrue("plural" in values) + + def testAttributeValuesForNonEnumeratedAttribute(self): + values = self.voikko.attributeValues(u"BASEFORM") + self.assertEqual(None, values) + + def testAttributeValuesForUnknownAttribute(self): + values = self.voikko.attributeValues(u"XYZ") + self.assertEqual(None, values) + def testHyphenationPattern(self): pattern = self.voikko.getHyphenationPattern(u"kissa") self.assertEqual(" - ", pattern)
