Java Code Examples for org.apache.lucene.analysis.CharArrayMap#put()

The following examples show how to use org.apache.lucene.analysis.CharArrayMap#put() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: lumongo   File:    License: Apache License 2.0 6 votes vote down vote up
private static CharArrayMap<char[]> initializeDictHash() {
	CharArrayMap<char[]> charMap = new CharArrayMap<>(2000, false);

	try {
		URL url = Resources.getResource(BritishUSFilter.class, "british.txt");
		String text = Resources.toString(url, Charsets.UTF8_CHARSET);
		String[] lines = text.split("\n");
		for (String line : lines) {
			if (!line.startsWith("UK\tUS")) {
				String[] parts = line.split("\t");
				if (parts.length == 2) {
					charMap.put(parts[0].toCharArray(), parts[1].toCharArray());

	catch (Exception e) {
		throw new RuntimeException(e);
	return charMap;