<commit_before>"use strict"
const yaml = require("js-yaml")
const { ICUParser } = require("../..")
const debug = require("debug")("swift")
const xmlbuilder = require("xmlbuilder")
const _ = require("lodash")

class KeywordOrderParser extends ICUParser {
  onBasicArgument(element) {
    const { id } = element

    if (this.values.indexOf(id) == -1) {
      this.push(id)
    }
  }
}

function cleanString(str) {
  return str.replace(/\n/g, "\\n").replace(/'/g, "\\'")
}

const invalid = [
  "continue"
]

function fixKey(key) {
  const k = _.snakeCase(key)

  if (invalid.indexOf(k) > -1) {
    return k + "_"
  }

  return k
}

class AndroidStringsGenerator extends ICUParser {
  constructor() {
    super()
    this.root = xmlbuilder.create("resources")
    this.root.att("xmlns:xliff", "urn:oasis:names:tc:xliff:document:1.2")
  }<commit_msg>Fix Android quote escaping<commit_after>"use strict"
const yaml = require("js-yaml")
const { ICUParser } = require("../..")
const debug = require("debug")("swift")
const xmlbuilder = require("xmlbuilder")
const _ = require("lodash")

class KeywordOrderParser extends ICUParser {
  onBasicArgument(element) {
    const { id } = element

    if (this.values.indexOf(id) == -1) {
      this.push(id)
    }
  }
}

function cleanString(str) {
  return str
    .replace(/\n/g, "\\n")
    .replace(/(['"])/g, "\\$1")
}

const invalid = [
  "continue"
]

function fixKey(key) {
  const k = _.snakeCase(key)

  if (invalid.indexOf(k) > -1) {
    return k + "_"
  }

  return k
}

class AndroidStringsGenerator extends ICUParser {
  constructor() {
    super()
    this.root = xmlbuilder.create("resources")
    this.root.att("xmlns:xliff", "urn:oasis:names:tc:xliff:document:1.2")
  }
{'fraction_non_alphanumeric': 0.1748983149331784, 'fraction_numerical': 0.005229517722254503, 'mean_word_length': 3.507853403141361, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '3684900', 'n_tokens_mistral': 624, 'n_tokens_neox': 599, 'n_words': 122}