Friday, December 23, 2016

HTML5 Standard SpeechRecognition

According to this standard information, HTML5 web pages has internal standard support of voice recognition through JavaScript functions:

Speech Recognition Examples

Using speech recognition to fill an input-field and perform a web search.
Example 1
            
  <script type="text/javascript">
    var recognition = new SpeechRecognition();
    recognition.onresult = function(event) {
      if (event.results.length > 0) {
        q.value = event.results[0][0].transcript;
        q.form.submit();
      }
    }
  </script>

  <form action="http://www.example.com/search">
    <input type="search" id="q" name="q" size=60>
    <input type="button" value="Click to Speak" onclick="recognition.start()">
  </form>
            
          
Using speech recognition to fill an options list with alternative speech results.
Example 2
            
    <script type="text/javascript">
      var recognition = new SpeechRecognition();
      recognition.maxAlternatives = 10;
      recognition.onresult = function(event) {
        if (event.results.length > 0) {
          var result = event.results[0];
          for (var i = 0; i < result.length; ++i) {
            var text = result[i].transcript;
            select.options[i] = new Option(text, text);
          }
        }
      }

      function start() {
        select.options.length = 0;
        recognition.start();
      }
    </script>

    <select id="select"></select>
    <button onclick="start()">Click to Speak</button>
            
          
Using continuous speech recognition to fill a textarea.
Example 3
            
  <textarea id="textarea" rows=10 cols=80></textarea>
  <button id="button" onclick="toggleStartStop()"></button>

  <script type="text/javascript">
    var recognizing;
    var recognition = new SpeechRecognition();
    recognition.continuous = true;
    reset();
    recognition.onend = reset;

    recognition.onresult = function (event) {
      for (var i = resultIndex; i < event.results.length; ++i) {
        if (event.results.final) {
          textarea.value += event.results[i][0].transcript;
        }
      }
    }

    function reset() {
      recognizing = false;
      button.innerHTML = "Click to Speak";
    }

    function toggleStartStop() {
      if (recognizing) {
        recognition.stop();
        reset();
      } else {
        recognition.start();
        recognizing = true;
        button.innerHTML = "Click to Stop";
      }
    }
  </script>
            
          
Using continuous speech recognition, showing final results in black and interim results in grey.
Example 4
            
  <button id="button" onclick="toggleStartStop()"></button>
  <div style="border:dotted;padding:10px">
    <span id="final_span"></span>
    <span id="interim_span" style="color:grey"></span>
  </div>

  <script type="text/javascript">
    var recognizing;
    var recognition = new SpeechRecognition();
    recognition.continuous = true;
    recognition.interim = true;
    reset();
    recognition.onend = reset;

    recognition.onresult = function (event) {
      var final = "";
      var interim = "";
      for (var i = 0; i < event.results.length; ++i) {
        if (event.results[i].final) {
          final += event.results[i][0].transcript;
        } else {
          interim += event.results[i][0].transcript;
        }
      }
      final_span.innerHTML = final;
      interim_span.innerHTML = interim;
    }

    function reset() {
      recognizing = false;
      button.innerHTML = "Click to Speak";
    }

    function toggleStartStop() {
      if (recognizing) {
        recognition.stop();
        reset();
      } else {
        recognition.start();
        recognizing = true;
        button.innerHTML = "Click to Stop";
        final_span.innerHTML = "";
        interim_span.innerHTML = "";
      }
    }
  </script>
            
          


Speech Synthesis Examples

Spoken text.
Example 1
            
  <script type="text/javascript">
     speechSynthesis.speak(SpeechSynthesisUtterance('Hello World'));
  </script>
            
          
Spoken text with attributes and events.
Example 2
            
  <script type="text/javascript">
     var u = new SpeechSynthesisUtterance();
     u.text = 'Hello World';
     u.lang = 'en-US';
     u.rate = 1.2;
     u.onend = function(event) { alert('Finished in ' + event.elapsedTime + ' seconds.'); }
     speechSynthesis.speak(u);
  </script>
            
          


Expert Geoffrey Hinton

The first email:
Hello Mr. Hinton,

My name is Sergej Krivonos. Here is my linked page.
I want to use boost::mpl to implement compile-time neural network training algorithm.
I suppose it might speed up recognition jobs due to compile time and link time optimizations and reducing of multiplication by zero and precalculated values.
Recently I started learning your course on Coursera
Thus I have strong desire to design and implement compile-time trained recognition, I still might need some support. Please, let me know your thoughts as expert. 
The first answer:
There are 75,000 people taking my course.
Geoff
Next email:
Thank you much for answering. 
Is it worst to implement compile-time training? 
Is it possible to find a grant for this?
Maybe I shouldn't mention participating his course.

To be continued???
.
Oh Yeah...


Merry Christmass Geoffrey and The Happy New Year!

I present to you flat NN model:

Compile-time training result allows to precalculate weights and make each output to be equal a sum of (products of inputs and resulting output weights) - flat model.

Happy New Year Mr Hinton! Our kids will see adequate speaking robots!





2016-12-22 17:16 GMT+02:00 Сергей Кривонос <sergeikrivonos@gmail.com>:
Thank you much for answering.
Is it worst to implement compile-time training? 
Is it possible to find a grant for this?



--
Regards,
Sergei Krivonos
skype: sergio_krivonos

There are lots of questions about the math behind neural networks. And for machine learning too.
These pictures shown that in reality no need for more than two layers for neural networks that used in FANN library for example. But it only needed for current algorithm of learning. You can make two layer equivalent for any FANN net but to make it able to learn new algorithm of learning need to be developed. But seems it doable. I guess Geoffrey Hinton is the man who could develop such an algorithm. But would he be interested in such trivial networks that even not using sigmoids? Who knows... Only Geoffrey can answer such a question.
Maybe human cortex covers the function of such a "precompiled" flat but much faster neural network. And it uses electromagnetics for neuromediation. It is much faster. It might be updating while we sleeping. Neuroscientist might be interested to uncover this.
Another question is why outputs are dependent? To safe computer memory? Not actual for potential  compile-time algorithm. Each output gives a simple polynomial function by inputs.
Next question why such a simple function to produce? If extrapolate training data we can make much more precise function for every output much faster.
Lots of questions I see for the feature of Neural Networks. OpenMind is the library that would cover complete redesign for machine learning approach, contexts handling and goal-oriented reaching algorithm. It only needs some investment. Maybe some University or government grant.

Linux code freeze

Dear Mr. Torvalds,

I guess you tired to hear that C++ is good and Linux lacks support for C++ kernel modules.
In this post I'll try to give you my vision why its happening.
Lets look onto VFS code.

It seems to me this is actually using of C-style workaround for modern OOP approach that is supported well in C++. This is not a reason to support modules written in D though.

I remember you mentioned everything dies and its just a matter of time for the Linux kernel as well. But should we hurry with that? Isn't hard to adapt STL to kernel? I guess Linux STL port could be not only cross platform and configurable to build for both kernel and user modes, but it also may have best implementation to hug tight the kernel. Think about it: C++ programs could become much faster running on Linux.
You may have hear about STLport. Implementing an allocator for in-kernel use is a student task. Implementing fs layer seems to me simple enough. Everything is do-able!

So what do I propose:
  • Implement new kernel-compatible C++ standard.
  • Implement thin user mode wrapper like libc[++?].
  • Allow C++ edits.
I believe society will applause.

Friday, December 16, 2016

letter to China

Well, just unbelievable... No comments.



Tenzin Gyatso acceptanse





Сергей Кривонос sergeikrivonos@gmail.com

21 окт.
кому: premier
Hello dear Li,

With all respect I please you to take to consideration my ask to invite Tenzin Gyatso back to his residence. He is highly respected person in whole world. As the time of old governance that caused his forced expulsion has gone and it is XX| century I guess this would be considered as highly welcome. I do not ask to give him any government post but only give him respect and make the invite.

Thank you and high regards,
Sergej Krivonos

Сергей Кривонос sergeikrivonos@gmail.com

25 окт.
кому: premier
Hi,

Please, let me know once the letter reach destination. I would also appreciate if you enrich the answer with your opinion on this subject regarding Dalai Lama XIV in face of Tenzin Gyatso status rehabilitation in China, please. Tibetian people and Chinese buddists as well as buddists of whole world would appreciate such a wide gesture of wisdom.

Сергей Кривонос sergeikrivonos@gmail.com

16 нояб.
кому: premier
Hi,
Still no answer. Looks like you have busy personal assistent. I'll try asking next premier.
25.10.2016 23:33 пользователь "Сергей Кривонос" <sergeikrivonos@gmail.com> написал:

Сергей Кривонос sergeikrivonos@gmail.com

9 дек. (7 дн. назад)
кому: premier
Hi,

Do you have in plan to give honor to Dalai Lama XIV and invite him back to his residence?

Monday, December 12, 2016

Green


Lariix Gmelini is the tree to seed on Mars or Greenland...o_O
    How can proud people of Greenland leave without trees? 
                                                                        They can plant!

OpenMind goes crowdfounding

You might heard about OpenMind project. The only open source C++ library for general purpose AI.
If not then I introduce:

  • Ambitious project with purpose not to hide AI from everyone like it made IBM (Watson), Google and Apple (Siri), but to make it applicable in every aspect of software development starting from games and ending with huge management solutions.
  • C++
  • Free&OpenSource
  • Result oriented goal management system
  • With support for both games and chatbots
The bed thing there is still lots of things to implement until it might be used properly. And that is why the project goes to Indiegogo! Lets support this brave ambitious project.
Presentation text:
OpenMind

An AI Library



Rationale



  • We need effective open source AI system
  • Watson is great diagnostics system, but can everyone use it? Is it moral to hide AI and retain progress when we still have hunger on our Earth?

OpenMind
Rationale


  • Game bots AI
  • Thousands of games with new AI algorithms. Generic AI system that may become standard solution for gaming AI.
  • Good test field for generic AI solution.


    OpenMind Rationale

  • Automated management systems is one of the main goals for the OM library.
  • Programming your goals will help you do not miss anything in any size business.

OpenMind Rationale
  • Techsupport
  • Keeping context of conversation is something lacks even Siri and Something everyone needs during conversation with tech support.
  • Emerging client phrases to client context gives effect of understanding client needs.

OpenMind​ Features

Trie​ is the base class of data structure for contexts.
It gives great speed for both insert and access operations for huge amount of data.
Same iterations count as each comparison in map search has.


Here is example of trie like structure. Common items are really common. By reading the key we are coming to its data. This is fastest algorithm for search by text key. Standard C++ library STL has data structure called map for this purposes. Each comparison of map during key search takes same iterations as whole search operation in trie. This is so because we use direct access to go through trie.


OpenMind Features

  • GoalGenerator to make goals
  • Faculties to reach goals
  • Goals are to be reached 

OpenMind Features
Context

  • Context is Trie
  • Context for conditions
  • Context for requirements

OpenMind
Result oriented algorithm

In human language it sounds simple: We need to do things that would make our needed conditions.
ToDo = Requirement - Conditions
So we need current conditions context described. We need context requirement described as well. And we need information on context modification for all faculties.

OpenMind
Example
Car racing game bot control
In such an example, a car conditions context should contain its position and speed information. It also should refer road trajectory information. Closest to car objects could be simply gathered from loaded map object information.
What is required? Basically speaking, we only require position and speed to be the same as the best race trajectory has. Assuming the best trajectory includes an object speed information. This is the bot goal to keep as much closer to the best trajectory as it can. 
The best algorithm would cause exact match of the car trajectory to an estimated best trajectory path. This is called the win strategy.
Each iteration of the OpenMind AI powered game would have subgoals needed to reach the main goal to win. 

OpenMind Example
Bot race control : provide faculties
  • Implement «turn», «change speed» and other faculties
  • Initialize the Mind object with contexts and faculties.
  • Voila!​ An AI is ready.



OpenMind
Predictions
The OpenMind library has fully support custom predictions currently. This is good enough to implement a car racing game bot AI control. But it might be not as cozy to use to predict complex events like weather for example.
In plan to implement swappable dynamic neural network powered prediction system.
There is also an idea to implement original compile-time neural network training based on boost MPL views. Such an algorithm would allow to generate an optimized code for build in win strategy for predefined conditions.


Thanks for watching.