<commit_before><commit_msg>Prototype script for loading text files to mongodb<commit_after>import com.mongodb.DBCollection
import com.mongodb.Mongo
import com.mongodb.MongoClientURI

@GrabResolver(name = 'repository', root = 'http://ci.decafdev.local/nexus/content/groups/public')
@Grab('com.gmongo:gmongo:1.5')
@Grab(group='org.mongodb', module='mongo-java-driver', version='3.4.2')

def uri = "mongodb://dev/text-files.test-collection";


MongoClientURI mongoURI = new MongoClientURI(uri);
Mongo mongo = new Mongo(mongoURI);
String collectionName = mongoURI.getCollection();
DBCollection collection = mongo.getDB(mongoURI.getDatabase()).getCollection(collectionName);

println collection
{'fraction_non_alphanumeric': 0.13642960812772134, 'fraction_numerical': 0.00725689404934688, 'mean_word_length': 7.313253012048193, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2644487', 'n_tokens_mistral': 232, 'n_tokens_neox': 221, 'n_words': 40}