<commit_before>import React, { Component } from 'react'
import { PropTypes } from 'react'
import classNames from 'classnames'
import RaisedButton from 'material-ui/lib/raised-button'
import IntlService from 'views/services/intl'
const intl = IntlService.instance
const { any, func, string } = PropTypes

class SearchWordsPhrases extends Component {
  static propTypes = {
    handleEnterSearch: func,
    handleSearch: func,
    resetSearch: func,
    updateSearchTerm: func,
    searchAlertInfo: any, // TODO: sometimes element, sometimes array
    searchTerm: string,
  }
  static defaultProps = {
    handleEnterSearch: () => {},
    handleSearch: () => {},
    resetSearch: () => {},
    updateSearchTerm: () => {},
    searchAlertInfo: null,
    searchTerm: '',
  }

  constructor(props) {
    super(props)
    ;['_handleEnterSearch', '_handleSearch', '_resetSearch', '_updateSearchTerm'].forEach(
      (method) => (this[method] = this[method].bind(this))
    )
  }

  render() {
    const { searchAlertInfo, searchTerm } = this.props
    return (
      <div>
        <div>
          <input
            type="text"
            onChange={this._updateSearchTerm}
            onKeyPress={this._handleEnterSearch}
            value={searchTerm}
          />{' '}
          <RaisedButton
            label={intl.trans('views.pages.explore.dialect.learn.words.search_words', 'Search Words', 'words')}
            onTouchTap={this._handleSearch}
            primary
          />{' '}
          <RaisedButton
            label={intl.trans('views.pages.explore.dialect.learn.words.reset_search', 'Clear Search', 'words')}
            onTouchTap={this._resetSearch}
            primary={false}
          />
        </div>

        {searchAlertInfo && <div className={classNames('alert', 'alert-info')}>{searchAlertInfo}</div>}
      </div>
    )
  }

  _updateSearchTerm(evt) {
    this.props.updateSearchTerm(evt)
  }
  _handleEnterSearch(evt) {
    // TODO: when hit enter searchAlertInfo is an array?
    this.props.handleEnterSearch(evt)
  }

  _handleSearch() {
    this.props.handleSearch()
  }
  _resetSearch() {
    this.props.resetSearch()
  }<commit_msg>SearchWordsPhrases: added react-redux-provide & input radio/checkboxes<commit_after>import React, { Component } from 'react'
import { PropTypes } from 'react'

import provide from 'react-redux-provide'

import classNames from 'classnames'
import RaisedButton from 'material-ui/lib/raised-button'
import IntlService from 'views/services/intl'

const intl = IntlService.instance
const { any, func, string } = PropTypes

@provide
class SearchWordsPhrases extends Component {
  static propTypes = {
    handleEnterSearch: func,
    handleSearch: func,
    resetSearch: func,
    updateSearchTerm: func,
    searchAlertInfo: any, // TODO: sometimes element, sometimes array
    searchTerm: string,
  }
  static defaultProps = {
    handleEnterSearch: () => {},
    handleSearch: () => {},
    resetSearch: () => {},
    updateSearchTerm: () => {},
    searchAlertInfo: null,
    searchTerm: '',
  }

  constructor(props) {
    super(props)
    ;['_handleEnterSearch', '_handleSearch', '_resetSearch', '_updateSearchTerm'].forEach(
      (method) => (this[method] = this[method].bind(this))
    )
  }

  render() {
    const { searchAlertInfo, searchTerm } = this.props
    return (
      <div>
        <div>
          <input
            type="text"
            onChange={this._updateSearchTerm}
            onKeyPress={this._handleEnterSearch}
            value={searchTerm}
          />{' '}
          <RaisedButton
            label={intl.trans('views.pages.explore.dialect.learn.words.search_words', 'Search Words', 'words')}
            onTouchTap={this._handleSearch}
            primary
          />{' '}
          <RaisedButton
            label={intl.trans('views.pages.explore.dialect.learn.words.reset_search', 'Clear Search', 'words')}
            onTouchTap={this._resetSearch}
            primary={false}
          />
          <div>
            <span>
              <input type="radio" name="searchType" id="searchAll" />
              <label htmlFor="searchAll">Search all fields</label>
            </span>
            <span>
              <input type="radio" name="searchType" id="searchAdvanced" />
              <label htmlFor="searchAdvanced">Advanced Search</label>
            </span>

            <span>
              <input type="checkbox" id="searchPhrase" />
              <label htmlFor="searchPhrase">Phrase</label>
            </span>
            <span>
              <input type="checkbox" id="searchWord" />
              <label htmlFor="searchWord">Word</label>
            </span>
            <span>
              <input type="checkbox" id="searchDefinitions" />
              <label htmlFor="searchDefinitions">Definitions</label>
            </span>
            <span>
              <input type="checkbox" id="searchPartOfSpeech" />
              <label htmlFor="searchPartOfSpeech">Part of speech</label>
            </span>
          </div>
        </div>

        {searchAlertInfo && <div className={classNames('alert', 'alert-info')}>{searchAlertInfo}</div>}
      </div>
    )
  }

  _updateSearchTerm(evt) {
    this.props.updateSearchTerm(evt)
  }
  _handleEnterSearch(evt) {
    this.props.handleEnterSearch(evt)
  }

  _handleSearch() {
    this.props.handleSearch()
  }
  _resetSearch() {
    this.props.resetSearch()
  }
{'fraction_non_alphanumeric': 0.1344770337576093, 'fraction_numerical': 0.0, 'mean_word_length': 2.4778704297626684, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 63, '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': '255726', 'n_tokens_mistral': 1594, 'n_tokens_neox': 1566, 'n_words': 290}