Created
February 19, 2016 03:00
-
-
Save linhmtran168/878a0d663c634f1f8966 to your computer and use it in GitHub Desktop.
Awk to parse mecab result
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
first_line=1; | |
idx=1; | |
max_words=100; | |
} | |
{ | |
if (index($4,"名詞") == 1) | |
if (first_line == 1) { | |
printf "%s", toupper($1); | |
first_line=0; | |
idx++; | |
} else { | |
if ((idx % max_words) == 1) { | |
printf "\n%s", toupper($1); | |
} else { | |
printf " %s", toupper($1); | |
} | |
if (idx == max_word){ | |
idx = 1; | |
} else { | |
idx++; | |
} | |
} | |
} | |
END {print ""} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment