[libfolia] 02/03: Imported Upstream version 0.12

Joost van Baal joostvb at moszumanska.debian.org
Thu Nov 20 16:08:10 UTC 2014


This is an automated email from the git hooks/post-receive script.

joostvb pushed a commit to branch master
in repository libfolia.

commit eae8d4a9a3af1e3882491c17c2fd3be1b19b4a2c
Author: Joost van Baal-Ilić <joostvb at nusku.mdcc.cx>
Date:   Thu Nov 20 17:07:58 2014 +0100

    Imported Upstream version 0.12
---
 ChangeLog                   | 177 ++++++++++++++++++
 NEWS                        |  12 +-
 configure                   |  20 +--
 configure.ac                |   2 +-
 include/libfolia/document.h |   4 +-
 include/libfolia/folia.h    | 428 ++++++++++++++++++++++++--------------------
 src/Makefile.am             |   4 +-
 src/Makefile.in             |   4 +-
 src/document.cxx            |  65 +++++--
 src/folia.cxx               |  45 +++--
 src/folialint.cxx           |  65 +++++--
 11 files changed, 558 insertions(+), 268 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f0887df..6a006bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,180 @@
+2014-09-23 08:07  sloot
+
+	* [r17693] NEWS, configure.ac: bumping!
+
+2014-09-23 08:04  sloot
+
+	* [r17692] src/Makefile.am: bumped lib version
+
+2014-09-22 13:06  sloot
+
+	* [r17689] src/folialint.cxx: folialint now has opttions --debug
+	  and --permissive
+
+2014-09-22 11:43  sloot
+
+	* [r17688] include/libfolia/document.h, src/document.cxx: removed
+	  unused "load" option on Document.
+	  added a "mode" option. At the moment only 'permissive' value is
+	  hounour.
+	  Only fixup missing namespace declaration for 'permissive'
+
+2014-09-18 09:36  sloot
+
+	* [r17681] src/document.cxx: accept folia docs without namespaces
+	  declarations and silently
+	  add the default then.
+
+2014-09-18 08:53  sloot
+
+	* [r17679] src/document.cxx: more clear error message on
+	  missing/wrong namespace.
+	  It is unclear of that is really an error. :{
+
+2014-09-16 14:28  sloot
+
+	* [r17675] NEWS: updated NEWS
+
+2014-09-09 14:44  sloot
+
+	* [r17632] include/libfolia/folia.h: OEPS!
+
+2014-08-18 12:25  sloot
+
+	* [r17524] include/libfolia/folia.h, src/folia.cxx: more refctoring
+
+2014-08-18 09:59  sloot
+
+	* [r17523] include/libfolia/folia.h, src/folia.cxx: some
+	  reshuffling of functions. Alse sharpend the signature of some.
+
+2014-08-14 14:44  sloot
+
+	* [r17521] src/folia.cxx: allow Correction at more places
+
+2014-08-14 09:48  sloot
+
+	* [r17512] include/libfolia/document.h: added backward compatible
+	  doc.append().
+
+2014-08-13 15:23  sloot
+
+	* [r17509] include/libfolia/document.h: removed declared but not
+	  longer implemented function
+
+2014-08-13 15:20  sloot
+
+	* [r17507] include/libfolia/document.h, include/libfolia/folia.h,
+	  src/document.cxx, src/foliautils.cxx, src/simpletest.cxx: more
+	  cleanup
+
+2014-08-12 19:28  sloot
+
+	* [r17505] include/libfolia/folia.h: small fixes
+
+2014-08-12 15:00  sloot
+
+	* [r17504] include/libfolia/folia.h, src/folia.cxx: more cleaning
+	  up. API change too :)
+
+2014-08-12 14:00  sloot
+
+	* [r17503] include/libfolia/folia.h, src/folia.cxx: more cleanup
+
+2014-08-12 12:01  sloot
+
+	* [r17502] include/libfolia/folia.h, src/folia.cxx: cleaned up
+	  correct()
+
+2014-08-12 10:36  sloot
+
+	* [r17501] include/libfolia/folia.h, src/folia.cxx: start
+	  simplification of correct(). Now the diamond is tamed...
+
+2014-08-12 09:31  sloot
+
+	* [r17500] include/libfolia/folia.h: more cleanup. using virtual
+	  inheritanve even more.
+	  We don't fear the "deadly diamond of death"...
+
+2014-08-11 16:09  sloot
+
+	* [r17498] include/libfolia/folia.h, src/document.cxx,
+	  src/folia.cxx: started big refactoring. FoliaElement is a virtual
+	  base class now.
+	  Breaks the ABI, not the API.
+	  should to a cleaner interface....
+
+2014-08-07 15:56  sloot
+
+	* [r17495] include/libfolia/folia.h, src/folia.cxx: attemt to sort
+	  out correct(). Code is convoluted now. (still)
+
+2014-08-05 16:50  sloot
+
+	* [r17481] src/document.cxx, src/folia.cxx: allow Correction om
+	  more nodes
+
+2014-08-05 15:48  sloot
+
+	* [r17478] include/libfolia/folia.h, src/folia.cxx: fixed ID
+	  generation. use parent ID when needed
+
+2014-08-05 12:59  sloot
+
+	* [r17477] include/libfolia/foliautils.h, src/folia.cxx,
+	  src/foliautils.cxx: allow correcion in entity
+	  allow spanannotaion in correction children
+
+2014-07-17 10:30  sloot
+
+	* [r17462] include/libfolia/folia.h, src/folia.cxx: fixed problem
+	  with External node. Is was used after deletion.
+
+2014-07-16 14:24  sloot
+
+	* [r17455] src/folia.cxx: amother small fix
+
+2014-07-16 13:45  sloot
+
+	* [r17454] src/folia.cxx: fixed problems with text().
+
+2014-07-15 14:35  sloot
+
+	* [r17452] include/libfolia/folia.h, src/folia.cxx: fixed test()
+	  for markup
+
+2014-07-01 08:58  sloot
+
+	* [r17402] COPYING: add
+
+2014-07-01 08:57  sloot
+
+	* [r17401] COPYING: del
+
+2014-06-27 14:17  mvgompel
+
+	* [r17392] COPYING, src/folia.cxx: Accepted data for Note was wrong
+
+2014-06-25 15:22  sloot
+
+	* [r17389] src/folia.cxx: event may now contain all kind of
+	  structure elements
+
+2014-06-23 13:29  sloot
+
+	* [r17377] AUTHORS: courtesy
+
+2014-06-23 13:14  sloot
+
+	* [r17375] include/libfolia/folia.h, include/libfolia/foliautils.h,
+	  src/folia.cxx, src/foliautils.cxx: listitem ==> item
+
+2014-06-11 13:08  sloot
+
+	* [r17329] NEWS, src/folia.cxx: oesp, forgotten a checkin
+	  and some NEWS
+
 2014-05-26 14:34  sloot
 
 	* [r17259] include/libfolia/folia.h, include/libfolia/foliautils.h,
diff --git a/NEWS b/NEWS
index 856c202..b2bf06b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,13 +1,21 @@
-0.11 2014-06-xx
+0.12 2014-09-23
+[Ko van der Sloot]
+  * release 0.12
+  * library version bumped to 3.0.0 because ABI and API have heavily changed
+
+0.11 2014-09-16
   * now implements nodes like: Ref, Note, External
+  * Correction may be added to a lot more nodes
   * several bug fixes
   * better MT safe
+  * major API and ABI changes: Added a true virtual base,
+    using virtual inheritance.
 
 0.10
   * some XML stuff is moved to ticcutils
   * also use some other goodies form ticcutils
   * now implements new nodes like Metric, Coreferences and Semroles
-    (follwing the FoLiA 0.9 specs)
+    (following the FoLiA 0.9 specs)
   * a lot of code improvement too, including some bug fixes
 
 0.9
diff --git a/configure b/configure
index 38f8ae7..af2f475 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libfolia 0.11.
+# Generated by GNU Autoconf 2.69 for libfolia 0.12.
 #
 # Report bugs to <timbl at uvt.nl>.
 #
@@ -589,8 +589,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='libfolia'
 PACKAGE_TARNAME='libfolia'
-PACKAGE_VERSION='0.11'
-PACKAGE_STRING='libfolia 0.11'
+PACKAGE_VERSION='0.12'
+PACKAGE_STRING='libfolia 0.12'
 PACKAGE_BUGREPORT='timbl at uvt.nl'
 PACKAGE_URL=''
 
@@ -1344,7 +1344,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libfolia 0.11 to adapt to many kinds of systems.
+\`configure' configures libfolia 0.12 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1414,7 +1414,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libfolia 0.11:";;
+     short | recursive ) echo "Configuration of libfolia 0.12:";;
    esac
   cat <<\_ACEOF
 
@@ -1537,7 +1537,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libfolia configure 0.11
+libfolia configure 0.12
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2057,7 +2057,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libfolia $as_me 0.11, which was
+It was created by libfolia $as_me 0.12, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2920,7 +2920,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='libfolia'
- VERSION='0.11'
+ VERSION='0.12'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -16403,7 +16403,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libfolia $as_me 0.11, which was
+This file was extended by libfolia $as_me 0.12, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16469,7 +16469,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-libfolia config.status 0.11
+libfolia config.status 0.12
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index cd83805..adbcc8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@
 # $URL: https://ilk.uvt.nl/svn/sources/ucto/trunk/configure.ac $
 
 AC_PREREQ(2.59)
-AC_INIT([libfolia], [0.11], [timbl at uvt.nl])
+AC_INIT([libfolia], [0.12], [timbl at uvt.nl])
 AM_INIT_AUTOMAKE
 AC_CONFIG_SRCDIR([configure.ac])
 AC_CONFIG_MACRO_DIR([m4])
diff --git a/include/libfolia/document.h b/include/libfolia/document.h
index 58c8d50..b368d06 100644
--- a/include/libfolia/document.h
+++ b/include/libfolia/document.h
@@ -1,5 +1,5 @@
 /*
-  $Id: document.h 17512 2014-08-14 09:48:42Z sloot $
+  $Id: document.h 17688 2014-09-22 11:43:55Z sloot $
   $URL: https://ilk.uvt.nl/svn/sources/libfolia/trunk/include/libfolia/document.h $
 
   Copyright (c) 1998 - 2014
@@ -199,7 +199,7 @@ namespace folia {
     std::string _license;
     std::map<std::string,std::string> meta_atts;
     std::multimap<std::string,std::string> styles;
-    bool loadall;
+    std::string mode;
     std::string filename;
     std::string version;
     bool external;
diff --git a/include/libfolia/folia.h b/include/libfolia/folia.h
index 8c1d7b9..e44ff8e 100644
--- a/include/libfolia/folia.h
+++ b/include/libfolia/folia.h
@@ -1,5 +1,5 @@
 /*
-  $Id: folia.h 17507 2014-08-13 15:20:36Z sloot $
+  $Id: folia.h 17632 2014-09-09 14:44:49Z sloot $
   $URL: https://ilk.uvt.nl/svn/sources/libfolia/trunk/include/libfolia/folia.h $
 
   Copyright (c) 1998 - 2014
@@ -45,6 +45,9 @@ namespace folia {
   class Word;
   class TextContent;
   class Correction;
+  class NewElement;
+  class Original;
+  class Current;
   class Suggestion;
   class Division;
   class DependencyDependent;
@@ -65,51 +68,49 @@ namespace folia {
     friend bool operator==( const FoliaElement&, const FoliaElement& );
   public:
     virtual ~FoliaElement(){};
+    virtual void init()=0;
 
     virtual size_t size() const = 0;
-    virtual void fixupDoc( Document* ) = 0;
-    virtual FoliaElement *append( FoliaElement* ) = 0;
-    virtual FoliaElement *postappend( ) = 0;
-    virtual std::vector<FoliaElement*> findreplacables( FoliaElement * ) const = 0;
-    virtual void remove( size_t, bool = true ) = 0;
-    virtual void remove( FoliaElement *, bool = true ) = 0;
-    virtual void replace( FoliaElement * ) = 0;
-    virtual FoliaElement* replace( FoliaElement *, FoliaElement* ) = 0;
-
     virtual FoliaElement* index( size_t ) const = 0;
     virtual FoliaElement* rindex( size_t ) const = 0;
     FoliaElement* operator[]( size_t i ) const {
       return index(i);
     }
-    virtual bool isinstance( ElementType et ) const = 0;
-
-    virtual const Word* resolveword( const std::string& ) const = 0;
-
-    virtual void setDateTime( const std::string& ) = 0;
-    virtual std::string getDateTime() const = 0;
-
-    virtual std::vector<AbstractSpanAnnotation*> selectSpan() const = 0;
-
-    template <typename F>
-      F *addAnnotation( const KWargs& args ) {
-      F *res = 0;
-      try {
-	res = new F( doc(), args);
-      }
-      catch( std::exception& ){
-	delete res;
-	throw;
-      }
-      append( res );
-      return res;
-    }
 
+    virtual bool isinstance( ElementType et ) const = 0;
     template <typename F>
       bool isinstance() const {
       F obj("");
       return element_id() == obj.element_id();
     }
+    bool isSubClass( ElementType ) const;
+    bool isSubClass( const FoliaElement *c ) const {
+      return isSubClass( c->element_id() );
+    };
 
+    virtual void fixupDoc( Document* ) = 0;
+    virtual FoliaElement *parent() const = 0;
+    virtual void setParent( FoliaElement *p ) = 0;
+    virtual bool acceptable( ElementType ) const = 0;
+    virtual bool addable( const FoliaElement * ) const = 0;
+    virtual FoliaElement *append( FoliaElement* ) = 0;
+    virtual FoliaElement *postappend( ) = 0;
+    virtual void remove( size_t, bool = true ) = 0;
+    virtual void remove( FoliaElement *, bool = true ) = 0;
+    virtual std::vector<FoliaElement*> findreplacables( FoliaElement * ) const = 0;
+    virtual void replace( FoliaElement * ) = 0;
+    virtual FoliaElement* replace( FoliaElement *, FoliaElement* ) = 0;
+
+
+    virtual FoliaElement *head() const NOT_IMPLEMENTED;
+
+    // Sentences
+    virtual Sentence *addSentence( const KWargs& ) = 0;
+    Sentence *addSentence( const std::string& s ="" ){
+      return addSentence( getArgs(s) );
+    };
+
+    // Selections
     template <typename F>
       std::vector<F*> select( const std::string& st,
 			      const std::set<ElementType>& exclude,
@@ -180,6 +181,17 @@ namespace folia {
       return res;
     }
 
+    // annotations
+
+    virtual bool allowannotations() const { return false; };
+    virtual std::string annotator( ) const = 0;
+    virtual void annotator( const std::string& ) = 0;
+    virtual AnnotatorType annotatortype() const = 0;
+    virtual void annotatortype( AnnotatorType t ) =  0;
+    virtual AnnotationType::AnnotationType annotation_type() const = 0;
+    virtual PosAnnotation *addPosAnnotation( const KWargs& ) = 0;
+    virtual LemmaAnnotation *addLemmaAnnotation( const KWargs& ) = 0;
+
     template <typename F>
       std::vector<F*> annotations( const std::string& s = "" ) const {
       if ( allowannotations() ){
@@ -214,39 +226,75 @@ namespace folia {
       return v[0]; // always exist, otherwise annotations would throw()
     }
 
-    virtual std::vector<FoliaElement*> findspans( ElementType,
-						  const std::string& = "" ) const NOT_IMPLEMENTED;
-
     template <typename F>
-      std::vector<FoliaElement*> findspans( const std::string& st = "" ) const {
+      F *addAnnotation( const KWargs& args ) {
+      F *res = 0;
+      try {
+	res = new F( doc(), args);
+      }
+      catch( std::exception& ){
+	delete res;
+	throw;
+      }
+      append( res );
+      return res;
+    }
+    // span annotation
+    virtual std::vector<AbstractSpanAnnotation*> selectSpan() const = 0;
+    virtual std::vector<AbstractSpanAnnotation*> findspans( ElementType,
+							    const std::string& = "" ) const NOT_IMPLEMENTED;
+    template <typename F>
+      std::vector<AbstractSpanAnnotation*> findspans( const std::string& st = "" ) const {
       F obj("");
       return findspans( obj.element_id(), st );
     }
+    virtual AbstractSpanAnnotation *findspan( const std::vector<FoliaElement*>& ) const NOT_IMPLEMENTED;
 
-    std::vector<Sentence *> sentencePart() const;
+    // features
     virtual std::vector<std::string> feats( const std::string& ) const = 0;
     virtual std::string feat( const std::string& ) const = 0;
+
     //XML (de)serialisation
+    virtual FoliaElement* parseXml( const xmlNode * ) = 0;
     std::string xmlstring() const; // serialize to a string (XML fragment)
     virtual xmlNode *xml( bool, bool = false ) const = 0; //serialize to XML
-    virtual FoliaElement* parseXml( const xmlNode * ) = 0;
+
+    // text/string content
+    bool hastext( const std::string& = "current" ) const;
+
     virtual std::string str() const = 0;
     UnicodeString unicode() const { return text(); };
     UnicodeString toktext( const std::string& cls = "current" ) const {
       return deeptext( cls, true );
     }
     virtual UnicodeString text( const std::string& = "current", bool = false ) const = 0;
-    virtual TextContent *textcontent( const std::string& = "current" ) const = 0;
     UnicodeString stricttext( const std::string& = "current" ) const;
     virtual UnicodeString deeptext( const std::string& = "current", bool = false ) const = 0;
-    bool hastext( const std::string& = "current" ) const;
+
     virtual bool printable() const = 0;
-    virtual FoliaElement *head() const NOT_IMPLEMENTED;
-    virtual FoliaElement *getNew() const NOT_IMPLEMENTED;
-    virtual FoliaElement *getOriginal() const NOT_IMPLEMENTED;
-    virtual FoliaElement *getCurrent() const NOT_IMPLEMENTED;
-    virtual FoliaElement *split( FoliaElement *, FoliaElement *,
-				 const std::string& = "" ) NOT_IMPLEMENTED;
+
+    // Word
+    virtual Word *previous() const NOT_IMPLEMENTED;
+    virtual Word *next() const NOT_IMPLEMENTED;
+    virtual const Word* resolveword( const std::string& ) const = 0;
+    virtual std::vector<Word*> context( size_t,
+					const std::string& ="" ) const NOT_IMPLEMENTED;
+    virtual std::vector<Word*> leftcontext( size_t,
+					    const std::string& ="" ) const NOT_IMPLEMENTED;
+    virtual std::vector<Word*> rightcontext( size_t,
+					     const std::string& ="" ) const NOT_IMPLEMENTED;
+    virtual Word *addWord( const KWargs& ) = 0;
+    Word *addWord( const std::string& s ){
+      return addWord( getArgs(s) );
+    }
+
+    // corrections
+    virtual NewElement *getNew() const NOT_IMPLEMENTED;
+    virtual Original *getOriginal() const NOT_IMPLEMENTED;
+    virtual Current *getCurrent() const NOT_IMPLEMENTED;
+    virtual Correction *incorrection() const NOT_IMPLEMENTED;
+    virtual Correction *split( FoliaElement *, FoliaElement *,
+			       const std::string& = "" ) NOT_IMPLEMENTED;
 
     virtual Correction *mergewords( FoliaElement *,
 				    const std::vector<FoliaElement *>&,
@@ -258,40 +306,53 @@ namespace folia {
 				    const std::string& = "" ) NOT_IMPLEMENTED;
     virtual std::vector<Suggestion*> suggestions() const NOT_IMPLEMENTED;
     virtual Suggestion *suggestions( size_t ) const NOT_IMPLEMENTED;
-    virtual std::string subset() const NOT_IMPLEMENTED;
-    virtual FoliaElement *previous() const NOT_IMPLEMENTED;
-    virtual FoliaElement *next() const NOT_IMPLEMENTED;
-    virtual std::vector<Word*> context( size_t,
-					const std::string& ="" ) const NOT_IMPLEMENTED;
-    virtual std::vector<Word*> leftcontext( size_t,
-					    const std::string& ="" ) const NOT_IMPLEMENTED;
-    virtual std::vector<Word*> rightcontext( size_t,
-					     const std::string& ="" ) const NOT_IMPLEMENTED;
-    virtual FoliaElement *findspan( const std::vector<FoliaElement*>& ) const NOT_IMPLEMENTED;
+
+    virtual Correction *correct( const std::vector<FoliaElement*>&,
+				 const std::vector<FoliaElement*>&,
+				 const std::vector<FoliaElement*>&,
+				 const std::vector<FoliaElement*>&,
+				 const KWargs& ) NOT_IMPLEMENTED;
+    virtual Correction* correct( FoliaElement*,
+				 FoliaElement*,
+				 const KWargs& ) NOT_IMPLEMENTED;
+    virtual Correction* correct( FoliaElement*,
+				 FoliaElement*,
+				 const std::vector<FoliaElement*>&,
+				 const KWargs& ) NOT_IMPLEMENTED;
+    virtual Correction *correct( const std::string& = "" ) NOT_IMPLEMENTED;
+
+    // TextContent
+    virtual TextContent *textcontent( const std::string& = "current" ) const = 0;
+    TextContent *settext( const std::string&, const std::string& = "current" );
+    TextContent *settext( const std::string&, int , const std::string& = "current" );
+    TextContent *setutext( const UnicodeString&, const std::string& = "current" );
+    TextContent *setutext( const UnicodeString&, int , const std::string& = "current" );
     virtual int offset() const NOT_IMPLEMENTED;
-    virtual std::string getlang() const NOT_IMPLEMENTED;
-    virtual std::string setlang( const std::string& ) NOT_IMPLEMENTED;
 
+    // properties
+    virtual std::string getTextDelimiter( bool retaintok=false ) const = 0;
+    virtual void setDateTime( const std::string& ) = 0;
+    virtual std::string getDateTime() const = 0;
     virtual std::string pos( const std::string& = "" ) const = 0;
     virtual std::string lemma( const std::string& = "" ) const = 0;
     virtual std::string cls() const = 0;
     virtual std::string sett() const = 0;
-    virtual std::string annotator( ) const = 0;
-    virtual void annotator( const std::string& ) = 0;
-    virtual AnnotatorType annotatortype() const = 0;
-    virtual void annotatortype( AnnotatorType t ) =  0;
-    virtual AnnotationType::AnnotationType annotation_type() const = 0;
     virtual std::string classname() const = 0;
     virtual std::string n() const = 0;
     virtual std::string id() const = 0;
+    virtual double confidence() const = 0;
+    virtual void confidence( double ) = 0;
     virtual ElementType element_id() const = 0;
+    virtual size_t occurrences() const = 0;
+    virtual size_t occurrences_per_set() const = 0;
+    virtual Attrib required_attributes() const = 0;
     virtual std::string xmltag() const = 0;
+    virtual std::string subset() const NOT_IMPLEMENTED;
+
     virtual Document *doc() const = 0;
-    //    virtual xmlNs *foliaNs() const = 0;
     virtual Sentence *sentence() const NOT_IMPLEMENTED;
     virtual Paragraph *paragraph() const NOT_IMPLEMENTED;
     virtual Division *division() const NOT_IMPLEMENTED;
-    virtual Correction *incorrection() const NOT_IMPLEMENTED;
     virtual std::vector<Paragraph*> paragraphs() const NOT_IMPLEMENTED;
     virtual std::vector<Sentence*> sentences() const NOT_IMPLEMENTED;
     virtual std::vector<Word*> words() const NOT_IMPLEMENTED;
@@ -306,70 +367,32 @@ namespace folia {
     virtual Word *words( size_t ) const NOT_IMPLEMENTED;
     virtual std::vector<Word *> wordParts() const NOT_IMPLEMENTED;
     virtual Word *rwords( size_t ) const NOT_IMPLEMENTED;
+
     virtual DependencyDependent *dependent() const NOT_IMPLEMENTED;
 
-    std::string description() const;
-    virtual Sentence *addSentence( const KWargs& ) = 0;
-    Sentence *addSentence( const std::string& s ="" ){
-      return addSentence( getArgs(s) );
-    };
-    virtual Word *addWord( const KWargs& ) = 0;
-    Word *addWord( const std::string& s ){
-      return addWord( getArgs(s) );
-    }
-    TextContent *settext( const std::string&, const std::string& = "current" );
-    TextContent *settext( const std::string&, int , const std::string& = "current" );
-    TextContent *setutext( const UnicodeString&, const std::string& = "current" );
-    TextContent *setutext( const UnicodeString&, int , const std::string& = "current" );
+    virtual std::string description() const;
 
-    virtual PosAnnotation *addPosAnnotation( const KWargs& ) = 0;
-    virtual LemmaAnnotation *addLemmaAnnotation( const KWargs& ) = 0;
+    // alternatives
+    template <typename F>
+      F *addAlternative();
+    template <typename F>
+      F *addAlternative( const KWargs& );
     virtual std::vector<Alternative *> alternatives( ElementType,
 						     const std::string& = ""
 						     ) const NOT_IMPLEMENTED;
     std::vector<Alternative*> alternatives( const std::string& s = "" ) const {
       return alternatives( BASE, s );
     }
+
     virtual std::string content() const {
       throw NoSuchAnnotation( "content" );
     }
-    virtual Correction *correct( const std::vector<FoliaElement*>&,
-				 const std::vector<FoliaElement*>&,
-				 const std::vector<FoliaElement*>&,
-				 const std::vector<FoliaElement*>&,
-				 const KWargs& ) NOT_IMPLEMENTED;
-    virtual Correction* correct( FoliaElement*,
-				 FoliaElement*,
-				 const KWargs& ) NOT_IMPLEMENTED;
-    virtual Correction* correct( FoliaElement*,
-				 FoliaElement*,
-				 const std::vector<FoliaElement*>&,
-				 const KWargs& ) NOT_IMPLEMENTED;
-    virtual Correction *correct( const std::string& = "" ) NOT_IMPLEMENTED;
     virtual std::string src() const NOT_IMPLEMENTED;
     virtual UnicodeString caption() const NOT_IMPLEMENTED;
-    virtual int refcount() const = 0;
-    virtual void increfcount() = 0;
-    virtual FoliaElement *parent() const = 0;
-    virtual void setParent( FoliaElement *p ) = 0;
-    virtual void setAuth( bool b ) = 0;
     virtual std::vector<FoliaElement *> resolve() const NOT_IMPLEMENTED;
     virtual const FoliaElement* resolveid() const NOT_IMPLEMENTED;
-    bool isSubClass( ElementType ) const;
-    bool isSubClass( const FoliaElement *c ) const {
-      return isSubClass( c->element_id() );
-    };
-    virtual std::string getTextDelimiter( bool retaintok=false ) const = 0;
-    virtual void setAttributes( const KWargs& ) = 0;
-    virtual KWargs collectAttributes() const = 0;
-    virtual std::string generateId( const std::string& ) NOT_IMPLEMENTED;
-    virtual size_t occurrences() const = 0;
-    virtual size_t occurrences_per_set() const = 0;
-    virtual Attrib required_attributes() const = 0;
     virtual bool checkAtts() = 0;
 
-    virtual void init()=0;
-    virtual bool allowannotations() const { return false; };
 
     virtual std::vector<FoliaElement*> select( ElementType elementtype,
 					       bool = true ) const = 0;
@@ -383,38 +406,23 @@ namespace folia {
 					       const std::string&,
 					       const std::set<ElementType>& ,
 					       bool = true ) const = 0;
-    virtual bool acceptable( ElementType ) const = 0;
-    virtual bool addable( const FoliaElement * ) const = 0;
-    template <typename F>
-      F *addAlternative();
-    template <typename F>
-      F *addAlternative( const KWargs& );
-
+    // some 'internal stuff
+    virtual int refcount() const = 0;
+    virtual void increfcount() = 0;
+    virtual void setAttributes( const KWargs& ) = 0;
+    virtual KWargs collectAttributes() const = 0;
+    virtual void setAuth( bool b ) = 0;
+    virtual std::string generateId( const std::string& ) NOT_IMPLEMENTED;
   };
 
   class FoliaImpl: public virtual FoliaElement {
   public:
     //Constructor
     FoliaImpl( Document* = 0 );
-    virtual ~FoliaImpl();
     // static element Constructor
     static FoliaElement *createElement( Document *, const std::string&  );
+    virtual ~FoliaImpl();
 
-
-    std::vector<FoliaElement*> select( ElementType elementtype,
-				       bool = true ) const;
-    std::vector<FoliaElement*> select( ElementType elementtype,
-				       const std::set<ElementType>& ,
-				       bool = true ) const;
-    std::vector<FoliaElement*> select( ElementType elementtype,
-				       const std::string&,
-				       bool = true ) const;
-    std::vector<FoliaElement*> select( ElementType elementtype,
-				       const std::string&,
-				       const std::set<ElementType>& ,
-				       bool = true ) const;
-    bool checkAtts();
-    bool addable( const FoliaElement * ) const;
     void classInit( const std::string& s="" ){
       init(); // virtual init
       if ( !s.empty() ){
@@ -429,12 +437,37 @@ namespace folia {
       setAttributes( a ); // also virtual!
     }
 
+    //functions regarding contained data
+    size_t size() const { return data.size(); };
+    FoliaElement* index( size_t ) const;
+    FoliaElement* rindex( size_t ) const;
+
+    bool isinstance( ElementType et ) const {
+      return et == _element_id;
+    }
     template <typename F>
       bool isinstance() const {
       F obj("");
       return element_id() == obj.element_id();
     }
 
+    void fixupDoc( Document* );
+    FoliaElement *parent() const { return _parent; };
+    void setParent( FoliaElement *p ) { _parent = p ; };
+    bool acceptable( ElementType ) const;
+    bool addable( const FoliaElement * ) const;
+    FoliaElement *append( FoliaElement* );
+    FoliaElement *postappend( ) { return this; };
+    void remove( size_t, bool = true );
+    void remove( FoliaElement *, bool = true );
+    std::vector<FoliaElement*> findreplacables( FoliaElement * ) const;
+    void replace( FoliaElement * );
+    FoliaElement* replace( FoliaElement *, FoliaElement* );
+
+    // Sentences
+    Sentence *addSentence( const KWargs& );
+
+    // Selections
     template <typename F>
       std::vector<F*> select( bool recurse = true ) const {
       return FoliaElement::select<F>(recurse);
@@ -465,6 +498,14 @@ namespace folia {
       return FoliaElement::select<F>( exclude, recurse );
     }
 
+    std::string annotator( ) const { return _annotator; };
+    void annotator( const std::string& a ) { _annotator = a; };
+    AnnotatorType annotatortype() const { return _annotator_type; };
+    void annotatortype( AnnotatorType t ) { _annotator_type =  t; };
+    AnnotationType::AnnotationType annotation_type() const { return _annotation_type; };
+    PosAnnotation *addPosAnnotation( const KWargs& );
+    LemmaAnnotation *addLemmaAnnotation( const KWargs& );
+
     template <typename F>
       F *addAnnotation( const KWargs& args ) {
       return FoliaElement::addAnnotation<F>( args );
@@ -485,78 +526,72 @@ namespace folia {
       return FoliaElement::annotation<F>(st);
     }
 
+    // Span annotations
+    std::vector<AbstractSpanAnnotation*> selectSpan() const;
 
-    bool acceptable( ElementType ) const;
-    void setAttributes( const KWargs& );
-    KWargs collectAttributes() const;
-    xmlNode *xml( bool, bool = false ) const;
-    FoliaElement* parseXml( const xmlNode * );
+    // features
     std::vector<std::string> feats( const std::string& ) const;
     std::string feat( const std::string& ) const;
+
+    //XML (de)serialisation
+    FoliaElement* parseXml( const xmlNode * );
+    xmlNode *xml( bool, bool = false ) const;
+
+    // text/string content
+
     std::string str() const;
     UnicodeString text( const std::string& = "current", bool = false ) const;
-    //functions regarding contained data
-    size_t size() const { return data.size(); };
 
+    UnicodeString deeptext( const std::string& = "current", bool = false ) const;
+    bool printable() const { return PRINTABLE; };
 
-    FoliaElement* index( size_t ) const;
-    FoliaElement* rindex( size_t ) const;
+    // Word
+    const Word* resolveword( const std::string& ) const { return 0; };
+    Word *addWord( const KWargs& );
+
+    // TextContent
+    TextContent *textcontent( const std::string& = "current" ) const;
+
+    // properties
+    std::string getTextDelimiter( bool retaintok=false ) const;
+    void setDateTime( const std::string& );
+    std::string getDateTime() const;
     std::string pos( const std::string& = "" ) const ;
     std::string lemma( const std::string& = "" ) const;
     std::string cls() const { return _class; };
     std::string sett() const { return _set; };
-    void setDateTime( const std::string& );
-    std::string getDateTime() const;
-    std::vector<FoliaElement*> findreplacables( FoliaElement * ) const;
-    const Word* resolveword( const std::string& ) const { return 0; };
-    bool isinstance( ElementType et ) const {
-      return et == _element_id;
-    }
-
-    void fixupDoc( Document* );
-    FoliaElement *append( FoliaElement* );
-    FoliaElement *postappend( ) { return this; };
-    void remove( size_t, bool = true );
-    void remove( FoliaElement *, bool = true );
-    void replace( FoliaElement * );
-    FoliaElement* replace( FoliaElement *, FoliaElement* );
-
-    UnicodeString deeptext( const std::string& = "current", bool = false ) const;
-    UnicodeString toktext( const std::string& cls = "current" ) const {
-      return deeptext( cls, true );
-    }
-    TextContent *textcontent( const std::string& = "current" ) const;
-    std::string annotator( ) const { return _annotator; };
-    void annotator( const std::string& a ) { _annotator = a; };
-    AnnotatorType annotatortype() const { return _annotator_type; };
-    void annotatortype( AnnotatorType t ) { _annotator_type =  t; };
-    double confidence() const { return _confidence; };
-    void confidence( double d ) { _confidence = d; };
-    AnnotationType::AnnotationType annotation_type() const { return _annotation_type; };
     std::string classname() const { return toString(_element_id); };
     std::string n() const { return _n; };
     std::string id() const { return _id; };
+    double confidence() const { return _confidence; };
+    void confidence( double d ) { _confidence = d; };
     ElementType element_id() const { return _element_id; };
+    size_t occurrences() const { return _occurrences; };
+    size_t occurrences_per_set() const { return _occurrences_per_set; };
+    Attrib required_attributes() const { return _required_attributes; };
     std::string xmltag() const { return _xmltag; };
+
     Document *doc() const { return mydoc; };
 
+    bool checkAtts();
+
+    std::vector<FoliaElement*> select( ElementType elementtype,
+				       bool = true ) const;
+    std::vector<FoliaElement*> select( ElementType elementtype,
+				       const std::set<ElementType>& ,
+				       bool = true ) const;
+    std::vector<FoliaElement*> select( ElementType elementtype,
+				       const std::string&,
+				       bool = true ) const;
+    std::vector<FoliaElement*> select( ElementType elementtype,
+				       const std::string&,
+				       const std::set<ElementType>& ,
+				       bool = true ) const;
     int refcount() const { return _refcount; };
     void increfcount() { ++_refcount; };
-    FoliaElement *parent() const { return _parent; };
-    void setParent( FoliaElement *p ) { _parent = p ; };
+    void setAttributes( const KWargs& );
+    KWargs collectAttributes() const;
     void setAuth( bool b ){ _auth = b; };
-    bool printable() const { return PRINTABLE; };
-    size_t occurrences() const { return _occurrences; };
-    size_t occurrences_per_set() const { return _occurrences_per_set; };
-    Attrib required_attributes() const { return _required_attributes; };
-    PosAnnotation *addPosAnnotation( const KWargs& );
-    LemmaAnnotation *addLemmaAnnotation( const KWargs& );
-    std::vector<AbstractSpanAnnotation*> selectSpan() const;
-    Sentence *addSentence( const KWargs& );
-    Word *addWord( const KWargs& );
-    std::string getTextDelimiter( bool retaintok=false ) const;
-  private:
-    void addFeatureNodes( const KWargs& args );
 
   protected:
     xmlNs *foliaNs() const;
@@ -568,17 +603,18 @@ namespace folia {
     ElementType _element_id;
     std::set<ElementType> _accepted_data;
     AnnotationType::AnnotationType _annotation_type;
-
-    Attrib _required_attributes;
-    Attrib _optional_attributes;
+    std::string TEXTDELIMITER;
     size_t _occurrences;
     size_t _occurrences_per_set;
-    std::string TEXTDELIMITER;
     bool PRINTABLE;
-    bool AUTH;
+    Attrib _required_attributes;
+    Attrib _optional_attributes;
     std::string _id;
-    std::string _set;
     std::string _class;
+    std::string _set;
+
+  private:
+    void addFeatureNodes( const KWargs& args );
     std::string _annotator;
     std::string _n;
     std::string _datetime;
@@ -655,7 +691,7 @@ namespace folia {
 
   class AllowAnnotation: public virtual FoliaElement {
   public:
-    virtual bool allowannotations() const { return true; };
+    bool allowannotations() const { return true; };
   };
 
   class AbstractStructureElement: public FoliaImpl,
@@ -949,8 +985,8 @@ namespace folia {
   Word( const KWargs& a ): AbstractStructureElement(){ classInit( a ); };
   Word( Document *d, const std::string& s=""): AbstractStructureElement( d ){ classInit( s ); };
   Word( Document *d, const KWargs& a ): AbstractStructureElement( d ){ classInit( a ); };
-    FoliaElement *split( FoliaElement *, FoliaElement *,
-			 const std::string& = "" );
+    Correction *split( FoliaElement *, FoliaElement *,
+		       const std::string& = "" );
     Sentence *sentence() const;
     Paragraph *paragraph() const;
     Division *division() const;
@@ -965,7 +1001,7 @@ namespace folia {
 				    const std::string& = "" ) const;
     std::vector<Word*> rightcontext( size_t,
 				     const std::string& ="" ) const;
-    std::vector<FoliaElement*> findspans( ElementType,
+    std::vector<AbstractSpanAnnotation*> findspans( ElementType,
 					  const std::string& = "" ) const;
     FoliaElement *append( FoliaElement *);
     const Word* resolveword( const std::string& ) const;
@@ -1483,7 +1519,7 @@ namespace folia {
   AbstractAnnotationLayer( const KWargs& a ): FoliaImpl() { classInit( a ); };
   AbstractAnnotationLayer( Document *d, const std::string& s=""): FoliaImpl(d) { classInit( s ); };
   AbstractAnnotationLayer( Document *d, const KWargs& a ): FoliaImpl(d) { classInit( a ); };
-    FoliaElement *findspan( const std::vector<FoliaElement*>& ) const;
+    AbstractSpanAnnotation *findspan( const std::vector<FoliaElement*>& ) const;
   private:
     void init();
   };
diff --git a/src/Makefile.am b/src/Makefile.am
index 9033459..3700a2a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,4 @@
-# $Id: Makefile.am 17238 2014-05-22 14:26:29Z sloot $
+# $Id: Makefile.am 17692 2014-09-23 08:04:32Z sloot $
 # $URL $
 
 AM_CPPFLAGS = -I at top_srcdir@/include
@@ -6,7 +6,7 @@ AM_CPPFLAGS = -I at top_srcdir@/include
 LDADD = libfolia.la
 
 lib_LTLIBRARIES = libfolia.la
-libfolia_la_LDFLAGS = -version-info 2:1:0
+libfolia_la_LDFLAGS = -version-info 3:0:0
 
 libfolia_la_SOURCES = folia.cxx document.cxx foliautils.cxx
 
diff --git a/src/Makefile.in b/src/Makefile.in
index e3a7cff..48d17db 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -14,7 +14,7 @@
 
 @SET_MAKE@
 
-# $Id: Makefile.am 17238 2014-05-22 14:26:29Z sloot $
+# $Id: Makefile.am 17692 2014-09-23 08:04:32Z sloot $
 # $URL $
 
 
@@ -524,7 +524,7 @@ top_srcdir = @top_srcdir@
 AM_CPPFLAGS = -I at top_srcdir@/include
 LDADD = libfolia.la
 lib_LTLIBRARIES = libfolia.la
-libfolia_la_LDFLAGS = -version-info 2:1:0
+libfolia_la_LDFLAGS = -version-info 3:0:0
 libfolia_la_SOURCES = folia.cxx document.cxx foliautils.cxx
 folialint_SOURCES = folialint.cxx
 TESTS = $(check_PROGRAMS)
diff --git a/src/document.cxx b/src/document.cxx
index d38ef52..3fc8bf9 100644
--- a/src/document.cxx
+++ b/src/document.cxx
@@ -1,5 +1,5 @@
 /*
-  $Id: document.cxx 17507 2014-08-13 15:20:36Z sloot $
+  $Id: document.cxx 17688 2014-09-22 11:43:55Z sloot $
   $URL: https://ilk.uvt.nl/svn/sources/libfolia/trunk/src/document.cxx $
 
   Copyright (c) 1998 - 2014
@@ -140,11 +140,13 @@ namespace folia {
     KWargs::const_iterator it = kwargs.find( "debug" );
     if ( it != kwargs.end() )
       debug = stringTo<int>( it->second );
-    it = kwargs.find( "load" );
-    if ( it != kwargs.end() )
-      loadall = stringTo<bool>( it->second );
-    else
-      loadall = true;
+    it = kwargs.find( "mode" );
+    if ( it != kwargs.end() ){
+      mode = it->second;
+      if ( mode != "permissive" ){
+	throw runtime_error( "FoLiA::Document: unsupported mode value: "+mode );
+      }
+    }
     it = kwargs.find( "external" );
     if ( it != kwargs.end() )
       external = stringTo<bool>( it->second );
@@ -563,12 +565,13 @@ namespace folia {
   }
 
   bool checkNS( xmlNode *n, const string& ns ){
-    if ( getNS(n) == ns )
+    string tns = getNS(n);
+    if ( tns == ns )
       return true;
     else
       throw runtime_error( "namespace conflict for tag:" + Name(n)
 			   + ", wanted:" + ns
-			   + " got:" + getNS(n) );
+			   + " got:" + tns );
     return false;
   }
 
@@ -740,6 +743,14 @@ namespace folia {
     }
   }
 
+  void fixupNs( xmlNode *p, xmlNs *ns ){
+    while ( p ){
+      xmlSetNs( p, ns );
+      fixupNs( p->children, ns );
+      p = p->next;
+    }
+  }
+
   FoliaElement* Document::parseXml( ){
     getstyles();
     xmlNode *root = xmlDocGetRootElement( xmldoc );
@@ -753,9 +764,25 @@ namespace folia {
     }
     FoliaElement *result = 0;
     if ( root  ){
-      try {
-	if ( Name( root ) == "FoLiA" &&
-	     checkNS( root, NSFOLIA ) ){
+      if ( Name( root ) == "FoLiA" ){
+	string ns = getNS( root );
+	if ( ns.empty() ){
+	  if ( mode == "permissive" ){
+	    xmlNs *defNs = xmlNewNs( root,
+				     (const xmlChar *)NSFOLIA.c_str(), 0 );
+	    _foliaNsIn = defNs;
+	    fixupNs( root, defNs );
+	  }
+	  else {
+	    throw XmlError( "Folia Document should have namespace declaration "
+			    + NSFOLIA + " but none found " );
+	  }
+	}
+	else if ( ns != NSFOLIA ){
+	  throw XmlError( "Folia Document should have namespace declaration "
+			  + NSFOLIA + " but found: " + ns );
+	}
+	try {
 	  result = parseFoliaDoc( root );
 	  if ( result ){
 	    if ( isNCName( result->id() ) )
@@ -765,16 +792,16 @@ namespace folia {
 	    }
 	  }
 	}
-	else if ( Name( root ) == "DCOI" &&
-		  checkNS( root, NSDCOI ) ){
-	  throw runtime_error( "DCOI format not supported" );
-	}
-	else {
-	  throw runtime_error("root node must be FoLiA" );
+	catch ( exception& e ){
+	  throw XmlError( e.what() );
 	}
       }
-      catch ( exception& e ){
-	throw XmlError( e.what() );
+      else if ( Name( root ) == "DCOI" &&
+		checkNS( root, NSDCOI ) ){
+	throw XmlError( "DCOI format not supported" );
+      }
+      else {
+	throw XmlError( "root node must be FoLiA" );
       }
     }
     return result;
diff --git a/src/folia.cxx b/src/folia.cxx
index d6dfd62..da1f7fa 100644
--- a/src/folia.cxx
+++ b/src/folia.cxx
@@ -1,5 +1,5 @@
 /*
-  $Id: folia.cxx 17521 2014-08-14 14:44:01Z sloot $
+  $Id: folia.cxx 17524 2014-08-18 12:25:16Z sloot $
   $URL: https://ilk.uvt.nl/svn/sources/libfolia/trunk/src/folia.cxx $
 
   Copyright (c) 1998 - 2014
@@ -96,7 +96,6 @@ namespace folia {
     _occurrences_per_set = 1; // #Number of times this element may occur per set (0=unlimited, default=1)
     TEXTDELIMITER = "NONE" ;
     PRINTABLE = true;
-    AUTH = true;
   }
 
   FoliaImpl::~FoliaImpl( ){
@@ -384,7 +383,7 @@ namespace folia {
     if ( !_n.empty() )
       attribs["n"] = _n;
 
-    if ( !AUTH || !_auth )
+    if ( !_auth )
       attribs["auth"] = "no";
 
     return attribs;
@@ -886,28 +885,28 @@ namespace folia {
 
   bool FoliaImpl::checkAtts(){
     if ( _id.empty() && (ID & _required_attributes ) ){
-      throw ValueError( "ID is required for " + classname() );
+      throw ValueError( "attribute 'ID' is required for " + classname() );
     }
     if ( _set.empty() && (CLASS & _required_attributes ) ){
-      throw ValueError( "Set is required for " + classname() );
+      throw ValueError( "attribute 'set' is required for " + classname() );
     }
     if ( _class.empty() && ( CLASS & _required_attributes ) ){
-      throw ValueError( "Class is required for " + classname() );
+      throw ValueError( "attribute 'class' is required for " + classname() );
     }
     if ( _annotator.empty() && ( ANNOTATOR & _required_attributes ) ){
-      throw ValueError( "Annotator is required for " + classname() );
+      throw ValueError( "attribute 'annotator' is required for " + classname() );
     }
     if ( _annotator_type == UNDEFINED && ( ANNOTATOR & _required_attributes ) ){
-      throw ValueError( "Annotatortype is required for " + classname() );
+      throw ValueError( "attribute 'Annotatortype' is required for " + classname() );
     }
     if ( _confidence == -1 && ( CONFIDENCE & _required_attributes ) ){
-      throw ValueError( "Confidence is required for " + classname() );
+      throw ValueError( "attribute 'confidence' is required for " + classname() );
     }
     if ( _n.empty() && ( N & _required_attributes ) ){
-      throw ValueError( "N is required for " + classname() );
+      throw ValueError( "attribute 'n' is required for " + classname() );
     }
     if ( DATETIME & _required_attributes ){
-      throw ValueError( "datetime is required for " + classname() );
+      throw ValueError( "attribute 'datetime' is required for " + classname() );
     }
     return true;
   }
@@ -919,7 +918,7 @@ namespace folia {
       ok = addable( child );
     }
     catch ( XmlError& ){
-      // don't delethe the offending child in case of illegal reconnection
+      // don't delete the offending child in case of illegal reconnection
       // it will be deleted by the true parent
       throw;
     }
@@ -1961,8 +1960,8 @@ namespace folia {
     }
   }
 
-  FoliaElement *Word::split( FoliaElement *part1, FoliaElement *part2,
-			     const string& args ){
+  Correction *Word::split( FoliaElement *part1, FoliaElement *part2,
+			   const string& args ){
     return sentence()->splitWord( this, part1, part2, getArgs(args) );
   }
 
@@ -2185,9 +2184,9 @@ namespace folia {
     return 0;
   }
 
-  vector<FoliaElement*> Word::findspans( ElementType et,
-					 const string& st ) const {
-    vector<FoliaElement *> result;
+  vector<AbstractSpanAnnotation*> Word::findspans( ElementType et,
+						   const string& st ) const {
+    vector<AbstractSpanAnnotation *> result;
     if ( !folia::isSubClass( et , AnnotationLayer_t ) ){
       throw NotImplementedError( "findspans(" + toString( et ) +
 				 ") is not supported. " +
@@ -2205,7 +2204,7 @@ namespace folia {
 	      vector<FoliaElement*> wv = f->wrefs();
 	      for ( size_t j=0; j < wv.size(); ++j ){
 		if ( wv[j] == this ){
-		  result.push_back(f);
+		  result.push_back(as);
 		}
 	      }
 	    }
@@ -3051,7 +3050,7 @@ namespace folia {
     return res;
   }
 
-  FoliaElement *AbstractAnnotationLayer::findspan( const vector<FoliaElement*>& words ) const {
+  AbstractSpanAnnotation *AbstractAnnotationLayer::findspan( const vector<FoliaElement*>& words ) const {
     vector<AbstractSpanAnnotation*> av = selectSpan();
     for ( size_t i=0; i < av.size(); ++i ){
       vector<FoliaElement*> v = av[i]->wrefs();
@@ -3079,7 +3078,7 @@ namespace folia {
 			     accept + sizeof(accept)/sizeof(ElementType) );
     _annotation_type = AnnotationType::ALTERNATIVE;
     PRINTABLE = false;
-    AUTH = false;
+    _auth = false;
   }
 
   void AlternativeLayers::init(){
@@ -3091,7 +3090,7 @@ namespace folia {
       std::set<ElementType>( accept,
 			     accept + sizeof(accept)/sizeof(ElementType) );
     PRINTABLE = false;
-    AUTH = false;
+    _auth = false;
   }
 
   void AbstractCorrectionChild::init(){
@@ -3119,7 +3118,7 @@ namespace folia {
   void Original::init(){
     _xmltag = "original";
     _element_id = Original_t;
-    AUTH = false;
+    _auth = false;
   }
 
   void Suggestion::init(){
@@ -3129,7 +3128,7 @@ namespace folia {
     _annotation_type = AnnotationType::SUGGESTION;
     _occurrences=0;
     _occurrences_per_set=0;
-    AUTH = false;
+    _auth = false;
   }
 
   void Correction::init(){
diff --git a/src/folialint.cxx b/src/folialint.cxx
index 02efe55..55b2c61 100644
--- a/src/folialint.cxx
+++ b/src/folialint.cxx
@@ -1,5 +1,5 @@
 /*
-  $Id: folialint.cxx 17238 2014-05-22 14:26:29Z sloot $
+  $Id: folialint.cxx 17689 2014-09-22 13:06:25Z sloot $
   $URL: https://ilk.uvt.nl/svn/sources/libfolia/trunk/src/folialint.cxx $
 
   Copyright (c) 1998 - 2014
@@ -31,27 +31,70 @@
 #include <fstream>
 #include <string>
 #include <map>
+#include "ticcutils/CommandLine.h"
 #include "libfolia/document.h"
 
 using namespace std;
 
 void usage(){
-  cerr << "usage: folialint <foliafile> [<outputfile>]" << endl;
+  cerr << "usage: folialint [options] <foliafile> [<outputfile>]" << endl;
 }
 
 int main( int argc, char* argv[] ){
-  string outName;
-  if ( argc < 2 ){
-    usage();
-    exit( EXIT_FAILURE);
+  string inputName;
+  string outputName;
+  bool permissive;
+  string debug;
+  vector<string> fileNames;
+  try {
+    TiCC::CL_Options Opts( "hV", "debug:,permissive");
+    Opts.init(argc, argv );
+    if ( Opts.extract( 'h' ) ){
+      usage();
+      return EXIT_SUCCESS;
+    }
+    if ( Opts.extract( 'V' ) ){
+      cout << "folialint version 0.2" << endl;
+      cout << "based on [" << folia::VersionName() << "]" << endl;
+      return EXIT_SUCCESS;
+    }
+    permissive = Opts.extract("permissive");
+    Opts.extract( "debug", debug );
+    if ( !Opts.empty() ){
+      cerr << "unsupported option(s): " << Opts.toString() << endl;
+      return EXIT_FAILURE;
+    }
+    fileNames = Opts.getMassOpts();
+    if ( fileNames.size() == 0 ){
+      cerr << "missing input file" << endl;
+      return EXIT_FAILURE;
+    }
+    if ( fileNames.size() > 2 ){
+      cerr << "expected 1 input file, and 1 output file" << endl;
+      return EXIT_FAILURE;
+    }
+    inputName = fileNames[0];
+    if ( fileNames.size() == 2 ){
+      outputName = fileNames[1];
+    }
+    if ( inputName == outputName ){
+      cerr << "output name cannot be same as input name!" << endl;
+      return EXIT_FAILURE;
+    }
   }
-  if ( argc == 3 ){
-    outName == argv[2];
+  catch( exception& e ){
+    cerr << "FAIL: " << e.what() << endl;
+    exit( EXIT_FAILURE );
   }
   try {
-    folia::Document d("file='" + string(argv[1]) + "'"); //,debug='3'");"
-    if ( !outName.empty() )
-      d.save( outName );
+    string cmd = "file='" + inputName + "'";
+    if ( !debug.empty() )
+      cmd += ", debug='" + debug + "'";
+    if ( permissive )
+      cmd += ", mode='permissive'";
+    folia::Document d( cmd );
+    if ( !outputName.empty() )
+      d.save( outputName );
     else
       cout << d;
   }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libfolia.git



More information about the debian-science-commits mailing list