我可以为 DZC_FigureCitation 注释设置特征值
目前我能够匹配和设置特征值(章节和部分)图 1.1。我还需要匹配和设置图 1 的特征值(章节 = 0 和部分)。
样本输入:
Figure 1.1
Figure 1.2
Figure 1
Figure 2.3
Figure 2
脚本:
MayBeFigure (COLON|PERIOD)? NUM? (SPECIAL|PERIOD)? NUM{-> MARK(ChapterNumber,3),MARK(FigureNumber,5), MARK(FigureCitation, 1, 5),MARK(FIGURE,1)};
MayBeFigure{-PARTOF(FIGURE)} (COLON|PERIOD)? NUM{-PARTOF(ChapterNumber),-PARTOF(FigureCitation) -> MARK(FigureNumber,3),MARK(FigureCitation,1,3),MARK(FIGURE,1)};
BLOCK (foreach) FigureCitation {}
{
DECLARE DZC_FigureCitation(INT chapter,INT section);
ACTION FCC(INT chap,INT sect) = CREATE(DZC_FigureCitation, "chapter" = chap, "section" = sect);
INT Figchap=0;
INT Figsec;
(FIGURE (COLON|PERIOD)? ChapterNumber?{PARSE(Figchap)}(PERIOD|HYPHEN)? @FigureNumber{PARSE(Figsec)}){-PARTOF(DZC_FigureCitation),-PARTOF(DZC_SupplFigureCitation)-> FCC(Figchap,Figsec)};
}
预期输出:
Figure 1.1
chapter:1
section:1
Figure 1.2
chapter:1
section:2
Figure 1
chapter:0
section:1
Figure 2.3
chapter:2
section:3
Figure 2
chapter:0
section:2
接收输出:
Figure 1.1
chapter:1
section:1
Figure 1.2
chapter:1
section:2
Figure 1
chapter:1
section:1
Figure 2.3
chapter:2
section:3
Figure 2
chapter:2
section:2