- 论坛徽章:
- 0
|
本帖最后由 diwcrystal 于 2013-03-11 22:54 编辑
求教一个问题,关于文本按序补全的。
有一个文本有很多段落组成,每个段落以object开始,段落里有以atom_type开始的许多属性段,但是每个段落里头atom_type属性段不一致,譬如有些有ABC,有些有ABD,有些BCD,有什么好的办法将每个段落补全,按照文本总的属性段以及各段落中的先后顺序,先后顺序不会冲突,假如共有属性ABCDEF,那么段落一中加补DEF项,段落二中加补CEF项,哪个位子缺就重新添加到哪个位置,新增项value为"",谢谢。- object
- create "VAF "
- type "PER "
- subtype "OKE "
- article_type "ROOT_A"
- atom_type "A" value "AAA"
- atom_type "B" value "BBB"
- atom_type "D" value ""
- article_type "ROOT_B"
- atom_type "AA" value "AAA"
- atom_type "BA" value "BBB"
- atom_type "CA" value "CC"
- object
- create "VAFD "
- type "PER "
- subtype "OKE "
- article_type "ROOT_A"
- atom_type "A" value "AAA"
- atom_type "D" value ""
- object
- create "VAFC "
- type "PER "
- subtype "OKE "
- article_type "ROOT_A"
- atom_type "B" value "BBB"
- atom_type "D" value ""
复制代码 补全后- object
- create "VAF "
- type "PER "
- subtype "OKE "
- article_type "ROOT_A"
- atom_type "A" value "AAA"
- atom_type "B" value "BBB"
- atom_type "D" value ""
- article_type "ROOT_B"
- atom_type "AA" value "AAA"
- atom_type "BA" value "BBB"
- atom_type "CA" value "CC"
- object
- create "VAFD "
- type "PER "
- subtype "OKE "
- article_type "ROOT_A"
- atom_type "A" value "AAA"
- atom_type "B" value ""
- atom_type "D" value ""
- article_type "ROOT_B"
- atom_type "AA" value ""
- atom_type "BA" value ""
- atom_type "CA" value ""
- object
- create "VAFC "
- type "PER "
- subtype "OKE "
- article_type "ROOT_A"
- atom_type "A" value ""
- atom_type "B" value "BBB"
- atom_type "D" value ""
- article_type "ROOT_B"
- atom_type "AA" value ""
- atom_type "BA" value ""
- atom_type "CA" value ""
复制代码 |
|