private static void ingestModel(InputStream modelStream, String modelName) throws IOException {

		Scanner scanner1 = new Scanner(modelStream, "UTF-8");
		String currString = "";
		String[] charInfo;
		int currCount;

		int[][] beginTrigramCounts = new int[ASCII_CHAR_COUNT][ASCII_CHAR_COUNT]; // begin char is implied
		int[][] endTrigramCounts = new int[ASCII_CHAR_COUNT][ASCII_CHAR_COUNT]; // end char is implied
		int[][][] trigramCounts = new int[ASCII_CHAR_COUNT][ASCII_CHAR_COUNT][ASCII_CHAR_COUNT];

		long totalTrigrams = 0;

		// Ingest character counts file.
		try {
			while (scanner1.hasNextLine()) {

				currString = scanner1.nextLine();

				if (currString.startsWith("#")) {
					if (currString.contains(MODEL_TYPE_PREFIX)) {
						modelType = currString.substring(MODEL_TYPE_PREFIX.length() + 2);
					}
				}
				else if (currString.trim().length() > 0) {
					charInfo = currString.split("\\t");

					if (charInfo.length != 4) {
						throw new IOException("In model file " + modelName +
							", this line should split into 4 parts: " + currString);
					}
					currCount = Integer.parseInt(charInfo[3]);

					charInfo = convertToAsciiNums(charInfo);

					if (charInfo[0].equals("[^]")) {

						// Ignore the ^ 0 $ case, if somehow one-character strings were ingested during model creation
						if (!charInfo[2].equals("[$]")) {
							// Beginning of string
							beginTrigramCounts[Integer.parseInt(charInfo[1])][Integer.parseInt(charInfo[2])] +=
								currCount;
						}
					}
					else if (charInfo[2].equals("[$]")) {
						endTrigramCounts[Integer.parseInt(charInfo[0])][Integer.parseInt(charInfo[1])] +=
							currCount;
					}
					else {
						trigramCounts[Integer.parseInt(charInfo[0])][Integer.parseInt(charInfo[1])][Integer.parseInt(charInfo[2])] +=
							currCount;
					}

					totalTrigrams += currCount;
				}
			}
		}
		catch (NumberFormatException nfe) {
			throw new IOException("Can not parse line: " + currString + " in model file '" +
				modelName + "'");
		}
		finally {
			scanner1.close();
		}

		if (modelType.equals("")) {
			throw new IOException("Model file: " + modelName + " does not contain the model type.");
		}

		smoothCountsAndCalculateLogProbs(beginTrigramCounts, endTrigramCounts, trigramCounts,
			totalTrigrams);
	}
Read in model files, smooth counts, and calculate log probabilities. 

@param charFileToSlurp  File containing character ngram counts
@throws IOException
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/string/NGramUtils.java