From: Tara L Andrews Date: Thu, 12 Jul 2012 21:32:36 +0000 (+0200) Subject: stemmaweb bugfixes and style fixes; add 'punctuation' relationship type X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2Fstemmatology.git;a=commitdiff_plain;h=7b7abf10979385f65a15e873de8a6f41c610b50a stemmaweb bugfixes and style fixes; add 'punctuation' relationship type --- diff --git a/lib/Text/Tradition/Analysis.pm b/lib/Text/Tradition/Analysis.pm index 1a3e7b1..85fe90a 100644 --- a/lib/Text/Tradition/Analysis.pm +++ b/lib/Text/Tradition/Analysis.pm @@ -213,6 +213,8 @@ sub run_analysis { if( $rdg ) { $rdghash->{'text'} = $rdg->text . ( $rdg->rank == $rank ? '' : ' [' . $rdg->rank . ']' ); + $rdghash->{'is_ungrammatical'} = $rdg->grammar_invalid; + $rdghash->{'is_nonsense'} = $rdg->is_nonsense; } # Remove lacunose witnesses from this reading's list now that the # analysis is done @@ -753,8 +755,10 @@ sub analyze_location { $relation->{'annotation'} = $rel->annotation; } } - } - $rdgparents->{$p} = { 'label' => $prep, 'relation' => $relation }; + } + my $phash = { 'label' => $prep, 'relation' => $relation }; + $phash->{'text'} = $pobj->text if $pobj; + $rdgparents->{$p} = $phash; } $rdghash->{'reading_parents'} = $rdgparents; diff --git a/lib/Text/Tradition/Collation/Relationship.pm b/lib/Text/Tradition/Collation/Relationship.pm index f9035fc..227bb7b 100644 --- a/lib/Text/Tradition/Collation/Relationship.pm +++ b/lib/Text/Tradition/Collation/Relationship.pm @@ -4,7 +4,7 @@ use Moose; use Moose::Util::TypeConstraints; enum 'RelationshipType' => qw( spelling orthographic grammatical lexical - collated repetition transposition ); + collated repetition transposition punctuation ); enum 'RelationshipScope' => qw( local document global ); diff --git a/script/poslink.pl b/script/poslink.pl index 0f4be38..4b99b9f 100755 --- a/script/poslink.pl +++ b/script/poslink.pl @@ -111,6 +111,7 @@ foreach my $tinfo ( $dir->traditionlist() ) { next unless $rdg->has_lexemes; next if grep { !$_->is_disambiguated } $rdg->lexemes; next if is_sameword( $c, $r, $rdg ); + # Do the grammatical link if applicable my $gram; if( join( ' ', map { $_->form->lemma } $rdg->lexemes ) eq $rlem && $rlem !~ /\/ ) { @@ -119,6 +120,17 @@ foreach my $tinfo ( $dir->traditionlist() ) { $c->add_relationship( $r, $rdg, { 'type' => 'grammatical' } ); $gram = 1; } + + # Do a punctuation link (instead of a lexical link) if applicable + my $punct; + if( $rdg->text =~ /^[[:punct:]]$/ && $r->text =~ /^[[:punct:]]$/ ) { + say sprintf( "Linking %s (%s) and %s (%s) with punctuation rel", + $r, $r->text, $rdg, $rdg->text ); + $c->add_relationship( $r, $rdg, { 'type' => 'punctuation' } ); + $punct = 1; + } + + # Do the lexical link if applicable my @rdgpos = map { $_->form->morphstr } $rdg->lexemes; next unless @rpos == @rdgpos; my $lex = 1; @@ -134,7 +146,7 @@ foreach my $tinfo ( $dir->traditionlist() ) { $lex = 0; } } - if( $lex ) { + if( $lex && !$punct ) { if( $gram ) { warn sprintf( "Grammatical link already made for %s (%s) / %s (%s)", $r, $r->text, $rdg, $rdg->text ); diff --git a/stemmaweb/lib/stemmaweb/Controller/Stexaminer.pm b/stemmaweb/lib/stemmaweb/Controller/Stexaminer.pm index e7eee1b..4b8bff6 100644 --- a/stemmaweb/lib/stemmaweb/Controller/Stexaminer.pm +++ b/stemmaweb/lib/stemmaweb/Controller/Stexaminer.pm @@ -43,7 +43,7 @@ sub index :Path :Args(1) { # Get the analysis options my( $use_type1, $ignore_sort ) = ( 0, 'none' ); if( $c->req->method eq 'POST' ) { - $use_type1 = $c->req->param( 'show_type1' ) eq 'on' ? 1 : 0; + $use_type1 = $c->req->param( 'show_type1' ) ? 1 : 0; $ignore_sort = $c->req->param( 'ignore_variant' ); } $c->stash->{'show_type1'} = $use_type1; @@ -52,9 +52,9 @@ sub index :Path :Args(1) { my %analysis_options; $analysis_options{'exclude_type1'} = !$use_type1; if( $ignore_sort eq 'spelling' ) { - $analysis_options{'collapse'} = [ qw/ spelling orthographic / ]; + $analysis_options{'merge_types'} = [ qw/ spelling orthographic / ]; } elsif( $ignore_sort eq 'orthographic' ) { - $analysis_options{'collapse'} = 'orthographic'; + $analysis_options{'merge_types'} = 'orthographic'; } my $t = run_analysis( $tradition, %analysis_options ); diff --git a/stemmaweb/root/css/stexaminer.css b/stemmaweb/root/css/stexaminer.css index 5bf6401..1348dfa 100644 --- a/stemmaweb/root/css/stexaminer.css +++ b/stemmaweb/root/css/stexaminer.css @@ -1,3 +1,13 @@ +#topbanner { + width: 100%; + height: 100px; + margin-top: 20px; +} +#bannerinfo { + float: right; + margin-right: 12%; + margin-top: 15px; +} #options { position: relative; border: 1px #c6dcf1 solid; diff --git a/stemmaweb/root/src/stexaminer.tt b/stemmaweb/root/src/stexaminer.tt index de72766..1f3a945 100644 --- a/stemmaweb/root/src/stexaminer.tt +++ b/stemmaweb/root/src/stexaminer.tt @@ -8,8 +8,13 @@ var readingstats = [% reading_statistics %]; var graphdot = '[% graphdot %]'; [% END -%] -

Stexaminer

-

[% text_title %]

+
+ +

Stexaminer

+

[% text_title %]

+

Analysis options: