public static void processT(String tempDir)
            throws FileNotFoundException, NoSuchElementException, IOException, ProcessException
    {
        File trigramSortedInterDataFile = FileUtil.getFileInDirectoryWithSuffix(tempDir, TrigramExternalSort.DATA_SUFFIX);
        File unigramDataFile = FileUtil.getFileInDirectoryWithSuffix(tempDir, UnigramPreprocess.DATA_SUFFIX);
        String trigramDataFilePathname = tempDir + File.separator + FileUtil.getFilenameWithoutSuffix(trigramSortedInterDataFile) + '.' + DATA_SUFFIX;
        String trigramCountFilePathname = tempDir + File.separator + FileUtil.getFilenameWithoutSuffix(trigramSortedInterDataFile) + '.' + COUNT_SUFFIX;
    
        try (
            BufferedReader trigramSortedInterData = new BufferedReader(new FileReader(trigramSortedInterDataFile));
            BufferedWriter trigramData = new BufferedWriter(new FileWriter(trigramDataFilePathname));
            BufferedWriter trigramCount = new BufferedWriter(new FileWriter(trigramCountFilePathname));
        ){
            String unigramDataName = FileUtil.getFilenameWithoutSuffix(unigramDataFile.getCanonicalPath(), UnigramPreprocess.DATA_SUFFIX);
            String trigramDataName = FileUtil.getFilenameWithoutSuffix(trigramDataFilePathname, TrigramCountSummation.DATA_SUFFIX);
            // Add header to the files
            IOUtil.writePreprocTrigramHeader(trigramData, new File(unigramDataName), new File(trigramDataName), "data");
            IOUtil.writePreprocTrigramHeader(trigramCount, new File(unigramDataName), new File(trigramDataName), "count");
            
            int gram1ID = 0, gram2ID = 0, prevGram1ID = 0, prevGram2ID = 0;
            long freq = 0, count = 0;
            boolean isFirstGram = true;
    
            for (String inputLine; (inputLine = trigramSortedInterData.readLine()) != null; ) {
                StringTokenizer line = new StringTokenizer(inputLine);
    
                gram1ID = Integer.parseInt(line.nextToken());
                gram2ID = Integer.parseInt(line.nextToken());
    
                if (isFirstGram) {
                    prevGram1ID = gram1ID;
                    prevGram2ID = gram2ID;
                    freq = Long.parseLong(line.nextToken());
                    trigramData.write(Integer.toString(gram1ID));
                    isFirstGram = false;
                } else if (gram1ID == prevGram1ID && gram2ID == prevGram2ID) {
                    freq += Long.parseLong(line.nextToken());
                } else {
                    // Use frequency instead of relatedness.
                    if (freq > 0) {
                        trigramData.write("\t" + prevGram2ID + "\t" + freq);
                        count++;
                    }
                    
                    if (prevGram1ID != gram1ID)
                        trigramData.write("\n" + Integer.toString(gram1ID));
                    
                    prevGram1ID = gram1ID;
                    prevGram2ID = gram2ID;
                    freq = Long.parseLong(line.nextToken());
                }
            }
            if (prevGram1ID != gram1ID)
                trigramData.write("\n" + gram1ID);
            // Use frequency instead of relatedness.
            if (freq > 0) {
                trigramData.write("\t" + prevGram2ID + "\t" + freq);
                count++;
            }
            // Write cout to the cout file.
            trigramCount.write(Long.toString(count));
        }
    }