Added Schreibgebrauch features

Change-Id: I2eb4f6b32007370985e2cf4168e00a95cbde4001
diff --git a/lib/KorAP/Document.pm b/lib/KorAP/Document.pm
index 2e3da2a..8aeec55 100644
--- a/lib/KorAP/Document.pm
+++ b/lib/KorAP/Document.pm
@@ -116,7 +116,7 @@
   # Get document id and corpus id
   if ($rt && $rt->{'-docid'}) {
     $self->text_sigle($rt->{'-docid'});
-    if ($self->text_sigle =~ /^(([^_]+)_[^\._]+?)\.\d+$/) {
+    if ($self->text_sigle =~ /^(([^_]+)_[^\._]+?)\..+?$/) {
       $self->corpus_sigle($2);
       $self->doc_sigle($1);
     }
diff --git a/lib/KorAP/Index/Malt/Dependency.pm b/lib/KorAP/Index/Malt/Dependency.pm
new file mode 100644
index 0000000..1f55824
--- /dev/null
+++ b/lib/KorAP/Index/Malt/Dependency.pm
@@ -0,0 +1,30 @@
+package KorAP::Index::Malt::Dependency;
+use KorAP::Index::Base;
+use Data::Dumper;
+
+sub parse {
+  my $self = shift;
+
+  # Relation data
+  $$self->add_tokendata(
+    foundry => 'malt',
+    layer => 'dependency',
+    cb => sub {
+      my ($stream, $token, $tokens) = @_;
+
+      # Get MultiTermToken from stream
+      my $mtt = $stream->pos($token->pos);
+
+      # Serialized information from token
+      my $content = $token->hash;
+    }) or return;
+
+  return 1;
+};
+
+sub layer_info {
+  ['malt/d=rels']
+};
+
+
+1;
diff --git a/lib/KorAP/Index/Schreibgebrauch/Morpho.pm b/lib/KorAP/Index/Schreibgebrauch/Morpho.pm
new file mode 100644
index 0000000..195b084
--- /dev/null
+++ b/lib/KorAP/Index/Schreibgebrauch/Morpho.pm
@@ -0,0 +1,44 @@
+package KorAP::Index::Schreibgebrauch::Morpho;
+use KorAP::Index::Base;
+
+sub parse {
+  my $self = shift;
+
+  $$self->add_tokendata(
+    foundry => 'sgbr',
+    layer => 'lemma',
+    cb => sub {
+      my ($stream, $token) = @_;
+      my $mtt = $stream->pos($token->pos);
+
+      my $content = $token->hash->{fs}->{f};
+
+      my $found;
+
+      my $capital = 0;
+
+      my $lemmata = (ref $content->{fs}->{f} eq 'ARRAY') ?
+	$content->{fs}->{f} : [$content->{fs}->{f}];
+
+      my $first = 0;
+
+      foreach my $f (@$lemmata) {
+
+	# lemma
+	if (($f->{-name} eq 'lemma')
+	      && ($found = $f->{'#text'})) {
+	  # b($found)->decode('latin-1')->encode->to_string
+	  $mtt->add(term => 'sgbr/l:' . $found) unless $first++;
+	  $mtt->add(term => 'sgbr/lv:' . $found);
+	};
+      };
+    }) or return;
+
+  return 1;
+};
+
+sub layer_info {
+    ['sgbr/l=tokens', 'sgbr/lv=tokens']
+}
+
+1;