<commit_before>import React from 'react'
import Response from './response.jsx'
import _ from 'underscore'
import keysForPOS from './POSIndex.jsx'

export default React.createClass({

  getPOSTagsList: function() {
    const responses = this.props.responses;
    var posTagsList = {}, posTagsAsString = ""
    responses.forEach((response) => {
      posTagsAsString = response.posTags.join()
      if(posTagsList[posTagsAsString]) {
        posTagsList[posTagsAsString].count += response.count
        posTagsList[posTagsAsString].responses.push(response)
      } else {
        posTagsList[posTagsAsString] = {
          tags: response.posTags,
          count: response.count,
          responses: [
            response
          ]
        }
      }
    })
    return posTagsList
  },

  renderPOSTagsList: function() {
    var posTagsList = this.getPOSTagsList()
    _.each(posTagsList, (tag) => {
      tag.responses.sort((a,b) => {
        return b.count-a.count
      })
    })
    return _.map(posTagsList, (tag) => {
      // return (
      //   <div>
      //     {tag.tags.join("; ")} {"Hits: " + (tag.count===undefined? 0 : tag.count)}
      //     <br />
      //     {"Most common response: "}
      //     {tag.responses[0].text} {"Hits: " + (tag.responses[0].count===undefined ? 0 : tag.responses[0].count)}
      //     <br />
      //     <br />
      //   </div>
      // )
      // onClick={this.props.expand.bind(null, response.key)}
      var bgColor;
      var icon;
      if (!tag.responses[0].feedback) {
        bgColor = "not-found-response";
      } else if (!!tag.responses[0].parentID) {
        // var parentResponse = this.props.getResponse(tag.responses[0].parentID)
        bgColor = "algorithm-sub-optimal-response";
      } else {
        bgColor = (tag.responses[0].optimal ? "human-optimal-response" : "human-sub-optimal-response");
      }
      if (tag.responses[0].weak) {
        icon = "⚠️";
      }
      var tagsToRender = [];
      const posTagKeys = keysForPOS()

      tag.tags.forEach((index) => {
        tagsToRender.push(posTagKeys[index])
      })
      return (
        <header className={"card-content " + bgColor} >
          <div className="content">
            <div className="media">
              <div className="media-content">
                <p>{tagsToRender.join("---")}</p><commit_msg>Additional styling. Still need expanded functionality<commit_after>import React from 'react'
import Response from './response.jsx'
import _ from 'underscore'
import keysForPOS from './POSIndex.jsx'

export default React.createClass({

  getPOSTagsList: function() {
    const responses = this.props.responses;
    var posTagsList = {}, posTagsAsString = ""
    responses.forEach((response) => {
      posTagsAsString = response.posTags.join()
      if(posTagsList[posTagsAsString]) {
        posTagsList[posTagsAsString].count += response.count
        posTagsList[posTagsAsString].responses.push(response)
      } else {
        posTagsList[posTagsAsString] = {
          tags: response.posTags,
          count: response.count,
          responses: [
            response
          ]
        }
      }
    })
    return posTagsList
  },

  sortResponses: function(posTagsList) {
    _.each(posTagsList, (tag) => {
      tag.responses.sort((a,b) => {
        return b.count-a.count
      })
    })
    return posTagsList
  },

  renderPOSTagsList: function() {
    var posTagsList = this.sortResponses(this.getPOSTagsList())

    return _.map(posTagsList, (tag) => {
      var bgColor;
      var icon;
      if (!tag.responses[0].feedback) {
        bgColor = "not-found-response";
      } else if (!!tag.responses[0].parentID) {
        // var parentResponse = this.props.getResponse(tag.responses[0].parentID)
        bgColor = "algorithm-sub-optimal-response";
      } else {
        bgColor = (tag.responses[0].optimal ? "human-optimal-response" : "human-sub-optimal-response");
      }
      if (tag.responses[0].weak) {
        icon = "⚠️";
      }
      var tagsToRender = [];
      const posTagKeys = keysForPOS()

      tag.tags.forEach((index) => {
        tagsToRender.push(posTagKeys[index])
      })
      const headerStyle = {"borderColor": "black"}
      const contentStyle = {"marginBottom": "0px"}
      return (
        <header className={"card-content " + bgColor} style={headerStyle}>
          <div className="content">
            <div className="media">
              <div className="media-content" style={contentStyle}>
                <p>{tagsToRender.join("---")}</p>
{'fraction_non_alphanumeric': 0.14788732394366197, 'fraction_numerical': 0.0035211267605633804, 'mean_word_length': 2.2958665699782452, 'pattern_counts': {'":': 2, '<': 20, '<?xml version=': 0, '>': 30, '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': '4917', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1389, 'n_words': 237}