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
- 政策研究の多様性のために (2015-05-17)
- Ideology-Institution Dynamics with Causal Modeling (2015-02-24)
- 両立政策が結婚・出生をめぐる意思決定にあたえる経済的影響 (2015-02-18)
- 東北大学 文系4学部合同「クワトロセミナー」第4回「統計学のネクスト・ステージ: 公共的社会科学における統計分析の実践と展開」(2015-01-14) (2015-01-14)
- Tanaka S (2014) Survey Responses for NFRJ-08Panel (Japanese J Family Sociol. 26:165-8) (2014-11-16)
- @JSSunofficial on Twitter (2014-11-05)
- Public Sociology for Family-Related Institutions with Gender Equality (KAKENHI research plan (2015-2019) under review) (2014-10-23)
- Skelton: Perl script to visualize syntactic structure of Japanese text (2014-08-20)
- Program released: ISA14 RC06 session "Family Studies based on Quantitative Analyses of Surveys" (2014-07-19 Yokohama) (2014-07-19)
- 「現役世代支援」は少子化を促進する (2014-07-09)
- 投稿せず、引用せず、査読せず:高額雑誌への抵抗 (2014-06-24)
- Only 3? ISA14 papers using NFRJ (2014-06-03)
- ReMCat new search interface: remcat.tsigeto.info (2014-05-30)
- ISA14 papers I am interested (2014-05-28)
- ISA14 RC06 session "Family Studies based on Quantitative Analyses of Surveys" (2014-07-19 Yokohama) tentative program (2014-04-16)
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: ★☆★☆★☆.
Trackback:
http://blog.tsigeto.jp/tb.php/237-b9a12f18