mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-25 06:24:42 +00:00
Added MarkovNameGenerator, Added Disable Body Part Feature
Two New Features >> + Added Markov Name Generate + Corrected Hide Body Parts
This commit is contained in:
1 parent
f155ef2481
commit
3a36be0ae4
47 files changed
+14517
-93
No files matched your search
@@ -0,0 +1,41 @@
|
||||
package nikedemos.markovnames;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
//used exclusively by the Spanish surname dictionary - because the capitalization is a little bit different
|
||||
public class MarkovDictionarySPA extends MarkovDictionary {
|
||||
|
||||
public MarkovDictionarySPA(String dictionary, int seqlen, Random rng) {
|
||||
super(dictionary, seqlen, rng);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPost(String str) {
|
||||
return getCapitalizedSPA(str);
|
||||
}
|
||||
|
||||
public String getCapitalizedSPA(String str) {
|
||||
// for spanish capitalization
|
||||
|
||||
String[] parts = str.split("#");
|
||||
|
||||
StringBuilder build = new StringBuilder("");
|
||||
|
||||
for (int p = 0; p < parts.length; p++) {
|
||||
// capitalize this part, but only if it's not "de", "del", "la" or "los"
|
||||
if (!parts[p].equals("de") && !parts[p].equals("del") && !parts[p].equals("la")
|
||||
&& !parts[p].equals("los")) {
|
||||
parts[p] = getCapitalized(parts[p]);
|
||||
}
|
||||
|
||||
if (p > 0) // don't add spaces before the first part
|
||||
build.append(" ");
|
||||
|
||||
build.append(parts[p]);
|
||||
}
|
||||
|
||||
return build.toString();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user