Skip to content

Instantly share code, notes, and snippets.

@kyu999
Created August 7, 2014 23:04
Show Gist options
  • Save kyu999/5345c6dd8c59fd00df76 to your computer and use it in GitHub Desktop.
Save kyu999/5345c6dd8c59fd00df76 to your computer and use it in GitHub Desktop.
品詞使った改行ルール
〜くっつける〜
1. * + 助詞 
2. 形容詞 + 名詞
3. * + 助動詞
つまり切る位置は
1. 助詞の後
2. 形容詞 + 名詞 の後
3. 助動詞の後
まずは1と3だけで検証してみて、その後2についても考えてみる
@kyu999
Copy link
Author

kyu999 commented Aug 8, 2014

“ | 諦めない | ” :クオーテーションをくっつけたい。優先順位はそこまで高くない。
助詞+助詞は切らない
括弧開は切らない
助動詞の後は切らない

飛び込んで | 」 :とりあえず助詞の後ということで切ってしまっている

                        #if not (current_feature[0] == u"動詞" and current_feature[1] == u"非自立"):
                        #    breakable = True

elif pre_feature[1] == u"括弧開":

breakable = True

                    #手前が非記号 かつ 今が記号
                    #elif pre_feature[0] != u"記号" and current_feature[0] == u"記号":
                    #    if not (self.is_left_kakko(unicoded_surface) or current_feature[1] == u"括弧開"):
                    #        breakable = True

括弧は中身とくっつける

                    if self.is_left_kakko(unicoded_surface) or current_feature[1] == u"括弧開" or self.is_right_kakko(unicoded_surface) or current_feature[1] == u"括弧閉":
                        break_points.pop()

 #左括弧もしくは助動詞の場合は切らない
                if not (self.is_right_kakko(unicoded_surface) or current_feature[0] == u"助動詞"):

                    if current_feature[0] == u"助詞":
                        breakable = True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment