@BeforeClass public void setUp() { Random rng = new Random(42); database = new ArrayList<String>(); String[] dictionary = new String[] {"foo", "bar", "baz", "quz"}; for (int i = 0; i < 100000; ++i) database.add(dictionary[rng.nextInt(dictionary.length)]); aligner = new LongTextAligner(database, 3); }
@BeforeClass public void setUp() throws IOException { URL url = getClass().getResource("transcription-small.txt"); ArrayList<String> words = new ArrayList<String>(); Scanner scanner = new Scanner(url.openStream()); while (scanner.hasNext()) { words.add(scanner.next()); } scanner.close(); aligner = new LongTextAligner(words, 2); }
private void align(List<String> database, List<String> query, Integer... result) { LongTextAligner aligner = new LongTextAligner(database, 1); int[] alignment = aligner.align(query); assertThat(Utilities.asList(alignment), contains(result)); } }
LongTextAligner aligner = new LongTextAligner(transcript, TUPLE_SIZE); Map<Integer, WordResult> alignedWords = new TreeMap<Integer, WordResult>(); Queue<Range> ranges = new LinkedList<Range>();
LongTextAligner aligner = new LongTextAligner(transcript, TUPLE_SIZE); Map<Integer, WordResult> alignedWords = new TreeMap<Integer, WordResult>(); Queue<Range> ranges = new LinkedList<Range>();