<commit_before>package livelygig.client.utils

import livelygig.client.dtos.Connection
import livelygig.client.models.Label
import org.scalajs.dom._

/**
  * Created by shubham.k on 3/4/2016.
  */
object Utils {
  def GetSelfConnnection() : Connection ={
    val sessionUri = window.sessionStorage.getItem("sessionURI")
    val sessionUriSplit = sessionUri.split('/')
    val sourceStr = "agent://"+sessionUriSplit(2)
    Connection(sourceStr,"alias",sourceStr)
  }
  def GetLabelProlog(labelFamilies: Seq[Seq[Label]]) : String = {
    println(labelFamilies)
    val prolog = StringBuilder.newBuilder
    prolog.append("any(")
    val outerLen = 0
    val len = 0
    labelFamilies.foreach{ e=>prolog.append("[")
      println(outerLen)
      e.foreach{p=>
        println(len)
        if (len == e.length){
          prolog.append(p.text+",")
        } else {
          prolog.append(prolog+p.text+"")
        }
        len+1
      }
      if (outerLen == labelFamilies.length ){
        prolog.append(prolog+"],")
      } else {
        prolog.append(prolog+"]")
      }
      prolog.append(prolog+"]")
      outerLen+1
    }
//    prolog +"["
//    val oho = for (labelFamily <- labelFamilies  ) yield  for(label<-labelFamily) yield prolog+label.text+","
//    prolog+oho+")"
    prolog.toString()
  }
}<commit_msg>Adding children selection on parent checkbox click for messages label.<commit_after>package livelygig.client.utils

import livelygig.client.dtos.Connection
import livelygig.client.models.Label
import org.scalajs.dom._

/**
  * Created by shubham.k on 3/4/2016.
  */
object Utils {
  def GetSelfConnnection() : Connection ={
    val sessionUri = window.sessionStorage.getItem("sessionURI")
    val sessionUriSplit = sessionUri.split('/')
    val sourceStr = "agent://"+sessionUriSplit(2)
    Connection(sourceStr,"alias",sourceStr)
  }
  def GetLabelProlog(labelFamilies: Seq[Seq[Label]]) : String = {
    // println("labelFamilies = " + labelFamilies)
    var labelsCount =  labelFamilies.length - 1
    val prolog = StringBuilder.newBuilder
    prolog.append("any(")
    val results = for{ a <- labelFamilies } yield {
      prolog.append("[")
      val res = for{b <- a }yield {prolog.append(b.text); if(b.parentUid != "self") prolog.append(",") }
      prolog.append("]")
      if(labelsCount!=0){
        prolog.append(",")
        labelsCount=(labelsCount-1)
      }
    }
    prolog.append(")")
    // println(prolog)
    prolog.toString()

  }
}
{'fraction_non_alphanumeric': 0.145748987854251, 'fraction_numerical': 0.008502024291497975, 'mean_word_length': 2.991922455573506, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '6348750', 'n_tokens_mistral': 846, 'n_tokens_neox': 813, 'n_words': 149}