private static void createTextFile(String filename, List<TermVector> termsList,
            List<Metadata> docsList, int[][] docMatrix) {
        BufferedWriter writer = null;

        try {
            File file = new File(LANGUAGE + "-" + filename);
            if (!file.exists()) {
                file.createNewFile();
            }
            writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
            writer.write(",");
            for (int i = 0; i < docsList.size(); i++) {
                writer.write(docsList.get(i).getID() + ",");
            }
            writer.newLine();
            for (int i = 0; i < termsList.size(); i++) {
                writer.write(termsList.get(i).getKeyword() + ",");
                for (int j = 0; j < docMatrix[i].length; j++) {
                    writer.write(docMatrix[i][j] + ",");
                }
                writer.newLine();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (writer != null) {
                    writer.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }