<?php

/*
 * ngram is word from text document
 */

/**
 * Description of Ngram
 *
 * @author hilit
 */
class Ngram {
    private  $name;
    private  $occurrences;
    
    
    public function __construct($name,$occurrences) {
      $this->name = $name;
      $this->occurrences = $occurrences;
    } 
    
    public function get_name(){
        return $this->name;
    }
    
    public function set_name($name){
       $this->name = $name;
        return true;
    }
    
    public function get_occurrences(){
        return $this->occurrences;
    }
    
    public function set_occurrences($occurrences){
        $this->occurrences = $occurrences;
        return true;
    }
    
    public function checkNgram($mysqli){
        $sqlNgram = toDbString($mysqli, $this->name);
        if (!mb_check_encoding($sqlNgram, 'UTF-8'))
        {
            write_to_log("ERROR", "ngram is not utf8: $this->name");
        }
        return $sqlNgram;
    }
}




