<commit_before>const uuidV4 = require('uuid/v4');

class Word {
  constructor(sentenceId, index, text) {
    this.id = uuidV4();
    this.sentenceId = sentenceId;
    this.index = index;
    this.text = text;
    return this;
  }


}

module.exports = Word;
<commit_msg>Add more methods<commit_after>const uuidV4 = require('uuid/v4');

let parent = new WeakMap();

class Word {
  constructor(sentence, index, text) {
    parent.set(this, sentence);

    this.id = uuidV4();
    this.sentenceId = sentence.id;
    this.index = index;
    this.text = text;
    return this;
  }

  parent() {
    return parent.get(this);
  }

  next() {
    let index = this.index;
    return this.parent().findWordByIndex(index + 1);
  }

  prev() {
    let index = this.index;
    return this.parent().findWordByIndex(index - 1);
  }
}

module.exports = Word;

{'fraction_non_alphanumeric': 0.1423487544483986, 'fraction_numerical': 0.009489916963226572, 'mean_word_length': 2.94392523364486, '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': '4237752', 'n_tokens_mistral': 302, 'n_tokens_neox': 293, 'n_words': 65}