Skip to content

Commit

Permalink
Make features layer grepable.
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldk committed May 3, 2016
1 parent 085a6fa commit 750306b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/layer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use conllx::Token;
use conllx::{Features, Token};
use std::collections::HashMap;

pub type LayerCallback = fn(&Token) -> Option<&str>;
Expand All @@ -8,6 +8,7 @@ lazy_static! {
{
let mut m: HashMap<&'static str, LayerCallback> = HashMap::new();
m.insert("cpos", cpos);
m.insert("features", features);
m.insert("form", form);
m.insert("headrel", head_rel);
m.insert("pheadrel", p_head_rel);
Expand All @@ -21,6 +22,10 @@ fn cpos(t: &Token) -> Option<&str> {
t.cpos()
}

fn features(t: &Token) -> Option<&str> {
t.features().as_ref().map(Features::as_str)
}

fn form(t: &Token) -> Option<&str> {
t.form()
}
Expand Down

0 comments on commit 750306b

Please sign in to comment.