<commit_before>// Copyright 2021, University of Colorado Boulder

/**
 * A collection of string patterns that are used with VoicingManager.collectResponses. Responses for Voicing are
 * categorized into one of "Name", "Object", "Context", or "Hint" responses. A node that implements voicing may
 * have any number of these responses and each of these responses can be enabled/disabled by user preferences
 * through the Properties of voicingManager. So we need string patterns that include each combination of response.
 *
 * Furthermore, you may want to control the order, punctuation, or other content in these patterns, so the default
 * cannot be used. VoicingResponsePatterns will have a collections of patterns that may be generally useful. But if
 * you need a collection that is not provided here, you can use createResponsePatterns() to create an object based
 * on one of the pre-made collections in this file. If you need something totally different, create your own from
 * scratch. The object you create must have exactly the keys of DEFAULT_RESPONSE_PATTERNS.
 *
 * @author <NAME> (PhET Interactive Simulations)
 */

import merge from '../../../../phet-core/js/merge.js';
import scenery from '../../scenery.js';

const VoicingResponsePatterns = {

  // Default order and punctuation for Voicing responses.
  DEFAULT_RESPONSE_PATTERNS: {
    nameObjectContextHint: '{{NAME}}, {{OBJECT}} {{CONTEXT}} {{HINT}}',
    nameObjectContext: '{{NAME}}, {{OBJECT}} {{CONTEXT}}',
    nameObjectHint: '{{NAME}}, {{OBJECT}} {{HINT}}',
    nameContextHint: '{{NAME}}, {{CONTEXT}} {{HINT}}',
    nameObject: '{{NAME}}, {{OBJECT}} ',
    nameContext: '{{NAME}}, {{CONTEXT}}',
    nameHint: '{{NAME}}, {{HINT}}',
    name: '{{NAME}}',
    objectContextHint: '{{OBJECT}} {{CONTEXT}} {{HINT}}',
    objectContext: '{{OBJECT}} {{CONTEXT}}',
    objectHint: '{{OBJECT}} {{HINT}}',
    contextHint: '{{CONTEXT}} {{HINT}}',
    object: '{{OBJECT}} ',
    context: '{{CONTEXT}}',
    hint: '{{HINT}}'
  },

  // Like the default response patterns, but the name follows the object response when both are present.
  OBJECT_NAME_CONTEXT_HINT_PATTERNS: {
    nameObjectContextHint: '{{OBJECT}} {{NAME}}, {{CONTEXT}} {{HINT}}',
    nameObjectContext: '{{OBJECT}} {{NAME}}, {{CONTEXT}}',
    nameObjectHint: '{{OBJECT}} {{NAME}}, {{HINT}}',
    nameContextHint: '{{NAME}}, {{CONTEXT}} {{HINT}}',
    nameObject: '{{OBJECT}} {{NAME}}',
    nameContext: '{{NAME}}, {{CONTEXT}}',
    nameHint: '{{NAME}}, {{HINT}}',
    name: '{{NAME}}',
    objectContextHint: '{{OBJECT}} {{CONTEXT}} {{HINT}}',
    objectContext: '{{OBJECT}} {{CONTEXT}}',
    objectHint: '{{OBJECT}} {{HINT}}',
    contextHint: '{{CONTEXT}} {{HINT}}',
    object: '{{OBJECT}} ',
    context: '{{CONTEXT}}',
    hint: '{{HINT}}'
  },

  /**
   * Create an Object containing patterns for responses that are generated by voicingManager.collectResponses. This
   * is convenient if you want to use one of the premade collections of patterns above, but have some of the patterns
   * slightly modified.
   * @public
   *
   * @param {Object} source - source for merge, probably one of the premade patterns objects in VoicingResponsPatterns
   * @param {Object} [options] - Object with keys that you want overridden
   * @returns {Object}
   */
  createResponsePatterns( source, options ) {
    const newPatterns = merge( VoicingResponsePatterns.DEFAULT_RESPONSE_PATTERNS, options );
    VoicingResponsePatterns.validatePatternKeys( newPatterns );<commit_msg>Add commas after object responses for default patterns, see https://github.com/phetsims/scenery/issues/1207<commit_after>// Copyright 2021, University of Colorado Boulder

/**
 * A collection of string patterns that are used with VoicingManager.collectResponses. Responses for Voicing are
 * categorized into one of "Name", "Object", "Context", or "Hint" responses. A node that implements voicing may
 * have any number of these responses and each of these responses can be enabled/disabled by user preferences
 * through the Properties of voicingManager. So we need string patterns that include each combination of response.
 *
 * Furthermore, you may want to control the order, punctuation, or other content in these patterns, so the default
 * cannot be used. VoicingResponsePatterns will have a collections of patterns that may be generally useful. But if
 * you need a collection that is not provided here, you can use createResponsePatterns() to create an object based
 * on one of the pre-made collections in this file. If you need something totally different, create your own from
 * scratch. The object you create must have exactly the keys of DEFAULT_RESPONSE_PATTERNS.
 *
 * @author <NAME> (PhET Interactive Simulations)
 */

import merge from '../../../../phet-core/js/merge.js';
import scenery from '../../scenery.js';

const VoicingResponsePatterns = {

  // Default order and punctuation for Voicing responses.
  DEFAULT_RESPONSE_PATTERNS: {
    nameObjectContextHint: '{{NAME}}, {{OBJECT}}, {{CONTEXT}} {{HINT}}',
    nameObjectContext: '{{NAME}}, {{OBJECT}}, {{CONTEXT}}',
    nameObjectHint: '{{NAME}}, {{OBJECT}}, {{HINT}}',
    nameContextHint: '{{NAME}}, {{CONTEXT}} {{HINT}}',
    nameObject: '{{NAME}}, {{OBJECT}}, ',
    nameContext: '{{NAME}}, {{CONTEXT}}',
    nameHint: '{{NAME}}, {{HINT}}',
    name: '{{NAME}}',
    objectContextHint: '{{OBJECT}}, {{CONTEXT}} {{HINT}}',
    objectContext: '{{OBJECT}}, {{CONTEXT}}',
    objectHint: '{{OBJECT}}, {{HINT}}',
    contextHint: '{{CONTEXT}} {{HINT}}',
    object: '{{OBJECT}} ',
    context: '{{CONTEXT}}',
    hint: '{{HINT}}'
  },

  // Like the default response patterns, but the name follows the object response when both are present.
  OBJECT_NAME_CONTEXT_HINT_PATTERNS: {
    nameObjectContextHint: '{{OBJECT}}, {{NAME}}, {{CONTEXT}} {{HINT}}',
    nameObjectContext: '{{OBJECT}}, {{NAME}}, {{CONTEXT}}',
    nameObjectHint: '{{OBJECT}}, {{NAME}}, {{HINT}}',
    nameContextHint: '{{NAME}}, {{CONTEXT}} {{HINT}}',
    nameObject: '{{OBJECT}}, {{NAME}}',
    nameContext: '{{NAME}}, {{CONTEXT}}',
    nameHint: '{{NAME}}, {{HINT}}',
    name: '{{NAME}}',
    objectContextHint: '{{OBJECT}}, {{CONTEXT}} {{HINT}}',
    objectContext: '{{OBJECT}}, {{CONTEXT}}',
    objectHint: '{{OBJECT}}, {{HINT}}',
    contextHint: '{{CONTEXT}} {{HINT}}',
    object: '{{OBJECT}}',
    context: '{{CONTEXT}}',
    hint: '{{HINT}}'
  },

  /**
   * Create an Object containing patterns for responses that are generated by voicingManager.collectResponses. This
   * is convenient if you want to use one of the premade collections of patterns above, but have some of the patterns
   * slightly modified.
   * @public
   *
   * @param {Object} source - source for merge, probably one of the premade patterns objects in VoicingResponsPatterns
   * @param {Object} [options] - Object with keys that you want overridden
   * @returns {Object}
   */
  createResponsePatterns( source, options ) {
    const newPatterns = merge( VoicingResponsePatterns.DEFAULT_RESPONSE_PATTERNS, options );
    VoicingResponsePatterns.validatePatternKeys( newPatterns );
{'fraction_non_alphanumeric': 0.15454928983265365, 'fraction_numerical': 0.0016875263675994938, 'mean_word_length': 4.429007633587786, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '7584091', 'n_tokens_mistral': 2022, 'n_tokens_neox': 2014, 'n_words': 735}