Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update for language changes
  • Loading branch information
tychosci committed Apr 4, 2013
1 parent b298c92 commit e2198e5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -18,6 +18,8 @@ Examples

extern mod mecab;

use mecab::IMeCabNode;

fn main() {
let mecab = mecab::new2("");

Expand Down
6 changes: 4 additions & 2 deletions examples/collect-nouns.rs
Expand Up @@ -3,6 +3,7 @@ extern mod mecab;

use std::arc;

use mecab::IMeCabNode;
use mecab::MeCabLattice;
use mecab::NOR_NODE;
use mecab::UNK_NODE;
Expand All @@ -16,8 +17,9 @@ fn collect_nouns(lattice: &MeCabLattice) -> ~[~str] {

if status == NOR_NODE || status == UNK_NODE {
let feature = n.get_feature();
if str::eq_slice(feature.split_str(",")[0], "名詞") {
v.push(n.get_surface());
for feature.each_split_char(',') |s| {
if s == "名詞" { v.push(n.get_surface()); }
break;
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion examples/katakanize.rs
@@ -1,5 +1,7 @@
extern mod mecab;

use mecab::IMeCabNode;

fn main() {
let mecab = mecab::new2("");

Expand All @@ -15,8 +17,12 @@ fn main() {
let status = n.get_status();

if status == mecab::NOR_NODE {
let mut i = 0;
let feature = n.get_feature();
io::print(fmt!("%s", feature.split_str(",")[7]));
for feature.each_split_char(',') |s| {
if i == 7 { io::print(fmt!("%s", s)); }
i += 1;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions examples/softwakachi.rs
@@ -1,5 +1,7 @@
extern mod mecab;

use mecab::IMeCabNode;

fn main() {
let mecab = mecab::new2("-m -a");
let node = mecab.parse_to_node("東京特許許可局");
Expand Down
2 changes: 2 additions & 0 deletions examples/wakachigaki.rs
@@ -1,5 +1,7 @@
extern mod mecab;

use mecab::IMeCabNode;

fn main() {
let mecab = mecab::new2("");

Expand Down

0 comments on commit e2198e5

Please sign in to comment.