Derivazioni: Space for communication by TANAKA Sigeto
[About] [Author] [Archive] [Mobile] [RSS]

« 「論文作成の基礎」(金2) レポート提出先 «  | |  » 研究生 (2015春入学) 追加募集 (8月31日〆切) »

Skelton: Perl script to visualize syntactic structure of Japanese text

An one-liner JPerl (Shift JIS) script to mask Kanji, Katakana, Greek, and some kinds of symbol characters in Japanese texts.

    jperl -pe "s/[〇ー々0-9A-Za-zァ-ヶΑ-Ωα-ω亜-熙]+/□/g"

Broadly speaking, you can obtain an output containing punctuations, Hiragana, and ASCII characters by processing your text with this script. The following is an example of output:

□から□までのそれぞれの□を□に□す。□に□い□の□が□された□や、□がわからなくなった□などは□を□っていない。それらの□は、□2では、「□せず」の□に□した。□2の「□」の□としては、□の□1879を□の□として□っている。□とも、□した□のなかに、□の□として□となったものが3□ないし4□あった。それらをのぞいた□な□は、□2□ (2010□) では1622、□3□ (2011□) では1555、□4□ (2012□) では1515、□5□ (2013□) では1594であった。□3□と□4□の□がやや□である。ただし、いちばんすくない□4□でも、□は1500□を□できている。

In usual Japanese texts, Hiragana characters always indicate syntactic structure (such as suffixes, particles, auxiliaries, and conjunctions). By contrast, Kanji characters provide substantive meaning (such as nouns, verbs, adjectives, and adverbs). The script accordingly extracts syntactic structure without semantic inference. It thus offers a handy way to evaluate the readability of the text in terms of syntax.


日本語文章の漢字、カタカナ、ギリシャ文字、および一部の記号を □ に変換する簡単な JPerl (Shift JIS) スクリプト。

    jperl -pe "s/[〇ー々0-9A-Za-zァ-ヶΑ-Ωα-ω亜-熙]+/□/g"

これを日本語文章に適用すると、句読点、ひらがな、ASCII文字だけをのこした出力がえられる。 たとえばつぎのような感じである:

□から□までのそれぞれの□を□に□す。□に□い□の□が□された□や、□がわからなくなった□などは□を□っていない。それらの□は、□2では、「□せず」の□に□した。□2の「□」の□としては、□の□1879を□の□として□っている。□とも、□した□のなかに、□の□として□となったものが3□ないし4□あった。それらをのぞいた□な□は、□2□ (2010□) では1622、□3□ (2011□) では1555、□4□ (2012□) では1515、□5□ (2013□) では1594であった。□3□と□4□の□がやや□である。ただし、いちばんすくない□4□でも、□は1500□を□できている。

日本語の通常の文章では、ひらがなは主として統語構造を示すために使われる (活用語尾、助詞、助動詞、接続詞など)。 一方、漢字は、実質的な意味をあらわすことが多い (名詞、動詞、形容詞、副詞など)。 上記のスクリプトは、意味的な推測のきかない状態で統語構造だけを取り出すことになる。 「□の□を□の□として□っている」などのような文を読みあげてみて、構文が即座につかめるかどうかのテストをしてみるとよい。



Related articles



Comment:


Leave your comment

All items are optional (except the comment content). Posted comment will be immediately published, without preview/confirmation.

To pass my SPAM filter, include some non-ASCII characters more than 1% of Your Comment content. If you cannot type non-ASCII characters, copy & paste the star marks: ★☆★☆★☆.

Name
Title
E-mail (not to be published)
Your comment
Secret
Only the blog owner can read your comment


Trackback:

http://blog.tsigeto.jp/tb.php/237-b9a12f18


Recent

Articles

Comments

Trackbacks


Archive

Monthly

Categories [Explanation]

| News:0 || Research:78 || Education:4 || School:278 || School/readu:3 || School/writing:17 || School/family:18 || School/occ:16 || School/quesu:6 || School/statu:4 || School/readg:18 || School/quesg:13 || School/statg:25 || School/kiso:5 || School/study:24 || School/intv:12 || School/book:0 || Profile:2 || WWW:7 || WWW/this:4 |