<commit_before>package lila.coach

object UrlList {

  object youtube {

    val max = 6

    case class Url(value: String) extends AnyVal

    def apply(text: String): List[Url] =
      text.lines.toList.map(_.trim).filter(_.nonEmpty) flatMap toUrl take max

    private val UrlRegex = """.*(?:youtube\.com|youtu\.be)/(?:watch)?(?:\?v=)([^"&?\/ ]{11}).*""".r

    /*
   * https://www.youtube.com/watch?v=wEwoyYp_iw8
   * https://www.youtube.com/embed/wEwoyYp_iw8
   */
    private def toUrl(line: String): Option[Url] = line match {
      case UrlRegex(id) => Url(s"https://www.youtube.com/embed/$id").some
      case _            => none
    }
  }

  object study {

    val max = 6
<commit_msg>support very short youtube URLs<commit_after>package lila.coach

object UrlList {

  object youtube {

    val max = 6

    case class Url(value: String) extends AnyVal

    def apply(text: String): List[Url] =
      text.lines.toList.map(_.trim).filter(_.nonEmpty) flatMap toUrl take max

    private val UrlRegex = """.*(?:youtube\.com|youtu\.be)/(?:watch)?(?:\?v=)?([^"&?\/ ]{11}).*""".r

    /*
   * https://www.youtube.com/watch?v=wEwoyYp_iw8
   * https://www.youtube.com/embed/wEwoyYp_iw8
   */
    private def toUrl(line: String): Option[Url] = line match {
      case UrlRegex(id) => Url(s"https://www.youtube.com/embed/$id").some
      case _            => none
    }
  }

  object study {

    val max = 6

{'fraction_non_alphanumeric': 0.17763623496107572, 'fraction_numerical': 0.008492569002123142, 'mean_word_length': 2.691906005221932, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 6, 'lorem ipsum': 0, 'www.': 6, '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': '2871071', 'n_tokens_mistral': 544, 'n_tokens_neox': 513, 'n_words': 100}