<commit_before>import React from 'react'

import style from '../css/style'
import SelectionHelpers from '../utils/selectionHelpers'

class SelectArea extends React.Component {
  constructor() {
    super();
    this.state = {
      inBox: false
    }
  }

  getSelectionText() {
    let verseText = this.props.verseText
    let text = "";
    var selection = window.getSelection();
    var indexOfTextSelection = selection.getRangeAt(0).startOffset;
    if (selection) {
      text = window.getSelection().toString();
    } else if (document.selection && document.selection.type != "Control") {
      text = document.selection.createRange().text;
    }
    if (text === "" || text === " ") {
      //do nothing since an empty space was selected
    } else {
      let expression = '/' + text + '/g';
      let wordOccurencesArray = verseText.match(eval(expression));
      let occurrences = wordOccurencesArray.length;
      let occurrence;
      let textBeforeSelection = verseText.slice(0, indexOfTextSelection);
      if (textBeforeSelection.match(eval(expression))) {
        occurrence = textBeforeSelection.match(eval(expression)).length + 1;
      } else {<commit_msg>Limit selections and alert user.<commit_after>import React from 'react'

import style from '../css/style'
import SelectionHelpers from '../utils/selectionHelpers'

class SelectArea extends React.Component {
  constructor() {
    super();
    this.state = {
      inBox: false
    }
  }

  getSelectionText() {
    if (this.props.checkInformation.selectedText.length >= 4) {
      alert('To select more than 4 words, highlight phrases instead of individual words.')
      return false
    }
    let verseText = this.props.verseText
    let text = "";
    var selection = window.getSelection();
    var indexOfTextSelection = selection.getRangeAt(0).startOffset;
    if (selection) {
      text = window.getSelection().toString();
    } else if (document.selection && document.selection.type != "Control") {
      text = document.selection.createRange().text;
    }
    if (text === "" || text === " ") {
      //do nothing since an empty space was selected
    } else {
      let expression = '/' + text + '/g';
      let wordOccurencesArray = verseText.match(eval(expression));
      let occurrences = wordOccurencesArray.length;
      let occurrence;
      let textBeforeSelection = verseText.slice(0, indexOfTextSelection);
      if (textBeforeSelection.match(eval(expression))) {
        occurrence = textBeforeSelection.match(eval(expression)).length + 1;
      } else {
{'fraction_non_alphanumeric': 0.12357787367595136, 'fraction_numerical': 0.003138485680659082, 'mean_word_length': 3.1463414634146343, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '1426323', 'n_tokens_mistral': 697, 'n_tokens_neox': 687, 'n_words': 177}