private Map<String, Integer> getCountMap(String[] input, HTMLDocument doc) throws BadLocationException {
        HashMap<String, Integer> result = new HashMap<String, Integer>();
        String docText = doc.getText(0, doc.getLength());
        for (String element : input) {
            Pattern pattern = Pattern.compile(element, Pattern.CASE_INSENSITIVE);
            Matcher matcher = pattern.matcher(docText);
            int count = 0;
            while(matcher.find())
            {
                count++;
            }
            result.put(element, count);
            count = 0;
        }
        return result;
    }