Beispiel #1
0
 /// <summary>
 /// Starts the timer running.
 /// </summary>
 public void Start()
 {
     if (_startTime != 0L)
     {
         _notReliable = true; // start called while timer already running
         this.LogInfo(GetName() + " timer.start() called without a stop()");
     }
     _startTime = Java.CurrentTimeMillis();
 }
Beispiel #2
0
        private static void PerformTestPartitionSizes(int absoluteBeamWidth, int tokenListSize, bool tokenListLarger)
        {
            var random      = new Random((int)Java.CurrentTimeMillis());
            var partitioner = new Partitioner();

            var parent = new Token(null, 0);
            var tokens = new Token[tokenListSize];

            for (var i = 0; i < tokens.Length; i++)
            {
                var logTotalScore = (float)random.NextDouble();
                tokens[i] = new Token(parent, null, logTotalScore, 0.0f, 0.0f, i);
            }

            var r = partitioner.Partition(tokens, tokens.Length, absoluteBeamWidth);

            if (tokenListLarger)
            {
                Assert.AreEqual(r, absoluteBeamWidth - 1);
            }
            else
            {
                Assert.AreEqual(r, tokenListSize - 1);
            }

            var firstList = new List <Token>();

            if (r >= 0)
            {
                var lowestScore = tokens[r].Score;

                for (var i = 0; i <= r; i++)
                {
                    Assert.IsTrue(tokens[i].Score >= lowestScore);
                    firstList.Add(tokens[i]);
                }
                for (var i = r + 1; i < tokens.Length; i++)
                {
                    Assert.IsTrue(lowestScore > tokens[i].Score);
                }


                firstList.Sort(new ScoreableComparator());

                var secondList = Arrays.AsList(tokens);
                secondList.Sort(new ScoreableComparator());


                for (int i = 0; i < firstList.Count; i++)
                {
                    var t1 = firstList[i];
                    var t2 = secondList[i];
                    Assert.AreEqual(t1, t2);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Called at the start of recognition. Gets the search manager ready to recognize.
        /// </summary>
        public override void StartRecognition()
        {
            this.LogInfo("starting recognition");

            Linguist.StartRecognition();
            _pruner.StartRecognition();
            _scorer.StartRecognition();
            LocalStart();
            if (_startTime == 0.0)
            {
                _startTime = Java.CurrentTimeMillis();
            }
        }
Beispiel #4
0
        /// <summary>
        /// Starts the timer at the given time.
        /// </summary>
        /// <param name="time"></param>
        public void Start(long time)
        {
            if (_startTime != 0L)
            {
                _notReliable = true; // start called while timer already running
                this.LogInfo(GetName() + " timer.start() called without a stop()");
            }

            if (time > Java.CurrentTimeMillis())
            {
                throw new RankException("Start time is later than current time");
            }
            _startTime = time;
        }
        public InputStreamEnumeration(ConcatFileDataSource owner, string batchFile, int startFile,
                                      int totalFiles)
        {
            _owner = owner;


            _totalFiles = totalFiles;
            _reader     = new StreamReader(batchFile);
            if (owner.SilenceFileName != null)
            {
                _inSilence     = true;
                _silenceRandom = new Random((int)Java.CurrentTimeMillis());

                _owner.SilenceCount = GetSilenceCount();
            }
            // go to the start file
            for (var i = 1; i < startFile; i++)
            {
                _reader.ReadLine();
            }
        }
Beispiel #6
0
 /// <summary>
 /// Stops the timer.
 /// </summary>
 /// <returns>the duration since start in milliseconds</returns>
 public long Stop()
 {
     if (_startTime == 0L)
     {
         _notReliable = true;        // stop called, but start never called
         this.LogInfo(GetName() + " timer.stop() called without a start()");
     }
     CurTime    = Java.CurrentTimeMillis() - _startTime;
     _startTime = 0L;
     if (CurTime > MaxTime)
     {
         MaxTime = CurTime;
     }
     if (CurTime < MinTime)
     {
         MinTime = CurTime;
     }
     Count++;
     _sum += CurTime;
     return(CurTime);
 }
Beispiel #7
0
 /**
  * /// Returns the total time since we start4ed
  *
  * /// @return the total time (in seconds)
  */
 private double GetTotalTime()
 {
     return((Java.CurrentTimeMillis() - _startTime) / 1000.0);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DataStartSignal"/> class.
 /// </summary>
 /// <param name="sampleRate">The sampling rate of the started data stream.</param>
 /// <param name="tagAsVadStream"><code>true</code> if this feature stream will contain vad-signals.</param>
 public DataStartSignal(int sampleRate, Boolean tagAsVadStream) : this(sampleRate, Java.CurrentTimeMillis(), tagAsVadStream)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DataStartSignal"/> class.
 /// </summary>
 /// <param name="sampleRate">The sampling rate of the started data stream.</param>
 public DataStartSignal(int sampleRate) : this(sampleRate, Java.CurrentTimeMillis())
 {
 }
Beispiel #10
0
 /// <summary>
 /// Constructs a DataEndSignal.
 /// </summary>
 /// <param name="duration">The duration of the entire data stream in milliseconds.</param>
 public DataEndSignal(long duration)
     : this(duration, Java.CurrentTimeMillis())
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SpeechEndSignal"/> class.
 /// </summary>
 public SpeechEndSignal()
     : this(Java.CurrentTimeMillis())
 {
 }