From: Tara L Andrews Date: Thu, 3 May 2012 09:05:49 +0000 (+0200) Subject: better lexeme serialization X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c3e04fb5fc2dfb0a8451c2a12538440548ccedbd;p=scpubgit%2Fstemmatology.git better lexeme serialization --- diff --git a/lib/Text/Tradition/Collation/Reading.pm b/lib/Text/Tradition/Collation/Reading.pm index 0e78cbc..29a8aa1 100644 --- a/lib/Text/Tradition/Collation/Reading.pm +++ b/lib/Text/Tradition/Collation/Reading.pm @@ -323,7 +323,17 @@ sub lemmatize { # reading lexemes. sub _serialize_lexemes { my $self = shift; - return Dump( [ $self->lexemes ] ); + my @lexstrs; + foreach my $l ( $self->lexemes ) { + my @mf; + foreach my $wf ( $l->matching_forms ) { + push( @mf, $wf->to_string ); + } + my $form = $l->form ? $l->form->to_string : ''; + push( @lexstrs, join( '|L|', $l->language, $l->string, $form, + join( '|M|', @mf ) ) ); + } + return join( '|R|', @lexstrs ); }