private double getSameWordValue(double SAME_WORD, String text) {

		// Replaces punctuation and more than one blank space with one blank space
		text = text.replaceAll("[ \\p{Punct}]", " ");
		text = text.replaceAll(" {2,}", " ");
		
		// Obtains words from the text
		String[] words = text.split(" ");

		// For each word:
		// 1) Deletes punctuation and spaces;
		// 2) Replaces all the letters that occur more than twice with two
		// occurrences of the letter
		for (int i = 0; i < words.length; i++) {
			words[i] = words[i].replaceAll("[ \\p{Punct}]", "");
			words[i] = replaceRepeatedLetter(words[i].toLowerCase());
		}

		// Checks presence of same string consecutively
		double repetitions = 0;
		for (int i = 0; i < words.length;) {
			int count = 0;
			for (int j = i; j < words.length; j++) {
				if (!words[i].equals(words[j])) {
					break;
				}
				count++;
			}
			if (count > 1) {
				// There are repetition of a word
				repetitions += count;
			}
			i += count;
		}

		// Calculates the value
		double rate;
		if (repetitions != 0) {
			// There are repetitions
			if (repetitions / words.length < 0.25) {
				rate = 25;
			} else {
				rate = 100 * (repetitions / words.length);
			}
		} else {
			// There are no repetitions
			rate = 0;
		}

		return (SAME_WORD / 100) * rate;
	}