Examples of NGramSynthesizer


Examples of org.kiji.schema.tools.synth.NGramSynthesizer

  protected int run(List<String> nonFlagArgs) throws Exception {
    // Generate a bunch of user rows with names and email addresses.
    final Random random = new Random(System.currentTimeMillis());
    final List<String> nameDictionary = loadNameDictionary(mNameDictionaryFilename);
    final WordSynthesizer nameSynth = new WordSynthesizer(random, nameDictionary);
    final NGramSynthesizer fullNameSynth = new NGramSynthesizer(nameSynth, 2);
    final EmailSynthesizer emailSynth = new EmailSynthesizer(random, nameDictionary);

    getPrintStream().printf("Generating %d users on kiji table '%s'...%n", mNumUsers, mTableURI);
    final KijiTableWriter tableWriter = mTable.openTableWriter();
    try {
      for (int iuser = 0; iuser < mNumUsers; iuser++) {
        final String fullName = fullNameSynth.synthesize();
        final String email =
            EmailSynthesizer.formatEmail(fullName.replace(" ", "."), emailSynth.synthesizeDomain());
        final EntityId entityId = mTable.getEntityId(email);
        tableWriter.put(entityId, "info", "name", fullName);
        tableWriter.put(entityId, "info", "email", email);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.