<commit_before>package de.hpi.ingestion.textmining.models

import scala.collection.immutable.Set
import scala.collection.SetLike
import scala.collection.mutable.Builder
import scala.language.implicitConversions
import scala.reflect.{ClassTag, classTag}


/**
  * Also known as muliset. It may contain elements multiple times.
  *
  * @param counts a map that stores the elements and their respective frequencies
  * @tparam A element type
  * @tparam B frequency type (e.g., Int or Double)
  */
class Bag[A, B <% BagCounter[B] : ClassTag](

	private val counts: Map[A, B] = Map.empty[A, B]) extends SetLike[A, Bag[A, B]] with Set[A] with Serializable {

	def getCounts(): Map[A, B] = counts

	override def +(elem: A): Bag[A, B] = {
		val count = this.counts.get(elem) match {
			case Some(x) => {
				x match {
					case t: Int => (t + 1).asInstanceOf[B]
					case t: Double => (t + 1.0).asInstanceOf[B]
				}
			}
			case None => {<commit_msg>:pencil2: Fix typo in multiset<commit_after>package de.hpi.ingestion.textmining.models

import scala.collection.immutable.Set
import scala.collection.SetLike
import scala.collection.mutable.Builder
import scala.language.implicitConversions
import scala.reflect.{ClassTag, classTag}


/**
  * Also known as multiset. It may contain elements multiple times.
  *
  * @param counts a map that stores the elements and their respective frequencies
  * @tparam A element type
  * @tparam B frequency type (e.g., Int or Double)
  */
class Bag[A, B <% BagCounter[B] : ClassTag](

	private val counts: Map[A, B] = Map.empty[A, B]) extends SetLike[A, Bag[A, B]] with Set[A] with Serializable {

	def getCounts(): Map[A, B] = counts

	override def +(elem: A): Bag[A, B] = {
		val count = this.counts.get(elem) match {
			case Some(x) => {
				x match {
					case t: Int => (t + 1).asInstanceOf[B]
					case t: Double => (t + 1.0).asInstanceOf[B]
				}
			}
			case None => {
{'fraction_non_alphanumeric': 0.13011542497376705, 'fraction_numerical': 0.0036726128016789086, 'mean_word_length': 3.662591687041565, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '3433721', 'n_tokens_mistral': 707, 'n_tokens_neox': 649, 'n_words': 200}