@Test(dependsOnMethods={"setup"})
public void testHasAlignedTerminalHierarchical() {
SymbolTable vocab = sourceCorpusArray.getVocabulary();
{
Pattern pattern = new Pattern(new Pattern(new Pattern(vocab, vocab.getIDs("de sesiones")), SymbolTable.X), vocab.getIDs("europo"));// del parlamento europeo"));
int[] terminalSequenceStartIndices = {4,8};
int[] sentenceNumbers = {0};
int phraseIndex = 0;
HierarchicalPhrases phrases =
new HierarchicalPhrases(pattern, terminalSequenceStartIndices, sentenceNumbers);
// HierarchicalPhrase phrase = new HierarchicalPhrase(pattern, terminalSequenceStartIndices, terminalSequenceEndIndices, sourceCorpusArray, length);
Assert.assertFalse(alignments.hasAlignedTerminal(0 , phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(1 , phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(2 , phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(3 , phrases, phraseIndex));
Assert.assertTrue(alignments.hasAlignedTerminal(4 , phrases, phraseIndex));
Assert.assertTrue(alignments.hasAlignedTerminal(5 , phrases, phraseIndex));
Assert.assertTrue(alignments.hasAlignedTerminal(6 , phrases, phraseIndex));
Assert.assertTrue(alignments.hasAlignedTerminal(7 , phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(8 , phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(9 , phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(10 , phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(11 , phrases, phraseIndex));
}
{
Pattern pattern = new Pattern(new Pattern(new Pattern(vocab, vocab.getIDs(", y")), PrefixTree.X), vocab.getIDs("sus"));// del parlamento europeo"));
int[] terminalSequenceStartIndices = {17,21};
int[] sentenceNumbers = {0};
int phraseIndex = 0;
HierarchicalPhrases phrases =
new HierarchicalPhrases(pattern, terminalSequenceStartIndices, sentenceNumbers);
Assert.assertFalse(alignments.hasAlignedTerminal(12 , phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(13 , phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(14 , phrases, phraseIndex));
Assert.assertTrue(alignments.hasAlignedTerminal(15, phrases, phraseIndex));
Assert.assertTrue(alignments.hasAlignedTerminal(16, phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(17, phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(18, phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(19, phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(20, phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(21, phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(22, phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(23, phrases, phraseIndex));
Assert.assertTrue(alignments.hasAlignedTerminal(24, phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(25, phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(26, phrases, phraseIndex));
Assert.assertFalse(alignments.hasAlignedTerminal(27, phrases, phraseIndex));
}
{
Pattern pattern = new Pattern(new Pattern(new Pattern(vocab, vocab.getIDs(",")), PrefixTree.X), vocab.getIDs(", y"));// del parlamento europeo"));
int[] terminalSequenceStartIndices = {9,17};
int[] sentenceNumbers = {0};
int phraseIndex = 0;
HierarchicalPhrases phrases =