forked from hogi/ilarkesto
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
5 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
/* | ||
* Copyright 2011 Witoslaw Koczewsi <[email protected]>, Artjom Kochtchi | ||
* | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero | ||
* General Public License as published by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | ||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public | ||
* License for more details. | ||
* | ||
* | ||
* You should have received a copy of the GNU General Public License along with this program. If not, see | ||
* <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
@@ -38,8 +38,7 @@ | |
public class Str extends ilarkesto.core.base.Str { | ||
|
||
public static void main(String[] args) { | ||
System.out.println(activateLinksInHtml(toHtml("abc <http://koczewski.de?x=x&y=y>"), null)); | ||
System.exit(0); | ||
System.out.println(getSimilarity("St. Märgen", "Sankt Märgen")); | ||
} | ||
|
||
private static final char[] UNICODE_CHARS = new char[] { ue, UE, oe, OE, ae, AE, sz, EUR }; | ||
|
@@ -52,6 +51,7 @@ public static void main(String[] args) { | |
private static final Object UIDLOCK = new Object(); | ||
|
||
public static List<String> tokenize(String s, String delimiters) { | ||
if (s == null) return Collections.emptyList(); | ||
List<String> ret = new ArrayList<String>(); | ||
StringTokenizer tokenizer = new StringTokenizer(s, delimiters); | ||
while (tokenizer.hasMoreTokens()) { | ||
|
@@ -134,36 +134,6 @@ public static String generateRandomSentence(int minWords, int maxWords, int minW | |
return sb.toString(); | ||
} | ||
|
||
public static boolean isSpeakable(String s) { | ||
if (s == null) return false; | ||
s = s.toLowerCase(); | ||
|
||
String vovels = "aeiouyäüö"; | ||
|
||
int vovelsInRow = 0; | ||
int consonantsInRow = 0; | ||
|
||
for (int i = 0; i < s.length(); i++) { | ||
char ch = s.charAt(i); | ||
String c = String.valueOf(ch); | ||
if (!Character.isLetter(ch)) { | ||
vovelsInRow = 0; | ||
consonantsInRow = 0; | ||
} else if (vovels.contains(c)) { | ||
vovelsInRow++; | ||
consonantsInRow = 0; | ||
} else { | ||
consonantsInRow++; | ||
vovelsInRow = 0; | ||
} | ||
if (vovelsInRow >= 4 || consonantsInRow >= 5) return false; | ||
} | ||
|
||
if (s.length() == consonantsInRow) return false; | ||
|
||
return true; | ||
} | ||
|
||
public static String generateRandomWord(int minLength, int maxLength, boolean uppercase) { | ||
String vovels = "aeiouy"; | ||
String consonants = "bcdfghjklmnpqrstvwxz"; | ||
|
This file was deleted.
Oops, something went wrong.