[問題]從CSV篩選擷取一段話中的某些特徵文字

作者: smileymin (smileymin)   2018-10-10 23:45:43
試了半天還是失敗Orz
想要請問大家下面的資料中:
1.如何在csv檔中只擷取檔案中*CHI此句話?
2.如何將換行的文字併到同一行?例如:4與5行是屬於同一句文字,如何合併?
感謝大家的幫忙 m(_ _)m
1 *CHI: I saw an elephant go swimming .
2 %mor: pro:sub|I v|see&PAST det:art|a n|elephant v|go part|swim-PRESP .
3 %gra: 1|2|SUBJ 2|0|ROOT 3|4|DET 4|5|SUBJ 5|2|COMP 6|5|OBJ 7|2|PUNCT
4 *CHI: <I saw eleph> [//] I saw the <g> [/] giraffe and the elephant <s>
5 [//] drop ball in the pool .
6 %mor: pro:sub|I v|see&PAST det:art|the n|giraffe coord|and det:art|the
7 n|elephant n|drop n|ball prep|in det:art|the n|pool .
8 %gra: 1|2|SUBJ 2|0|ROOT 3|4|DET 4|2|OBJ 5|4|CONJ 6|9|DET 7|9|MOD 8|9|MOD
9 9|5|COORD 10|9|NJCT 11|12|DET 12|10|POBJ 13|2|PUNCT
10 *CHI: I saw giraffe swimming in the pool to get that ball .
作者: HenryLiKing (HenryLiKing)   2018-10-10 23:57:00
第一題用RE應該可以 感覺~
作者: cancelpc (阿吉)   2018-10-11 02:02:00
這不是標準的 CSV 格式吧,自己用 re 剖析處理比較快
作者: mirror0227 (鏡子)   2018-10-11 16:33:00
這哪裡是CSV 一個逗點都沒有XD 換行合併抓\n刪掉就好

Links booklink

Contact Us: admin [ a t ] ucptt.com