Sunday, April 16, 2017

Introduction to Moses

Before coming to the Moses we need to know brief introduction to Natural Language Processing and Language translation. Then we could understand the Moses easily.

Natural Language Processing

Natural Language Processing is an Artificial Intelligence method which is used to communicate with Intelligent system such as Computers using natural language such as English, Tamil and Sinhala. By utilizing NLP, developers can organize and structure knowledge to perform tasks such as automatic summarization, translation, named entity recognition, relationship extraction, sentiment analysis, speech recognition, and topic segmentation. NLP considers the hierarchical structure of language: several words make a phrase, several phrases make a sentence. NLP is commonly used for text mining, machine translation, and automated question answering.

We can use NLP to translate from one language to another language. Instead of hand-coding large sets of rules, NLP can rely on machine learning to automatically learn these rules by analyzing a set of examples (i.e. a large corpus) and making a statistical inference.

Moses

Moses is a statistical machine translation system which allows you to translate from one language to another language by training translation models. For training the model you need collection of translated texts in both language (parallel corpus). Once you have a trained model, an efficient search algorithm quickly finds the highest probability translation among the exponential number of choices. It is a data driven machine translation approach. Moses system based on the Bayes theorem. 

If we explain this in translation point of view, probability of translation from f language to e language is depend on probability of translation from e language to f language and probability of  e language.

Further the system can be drilled down as log linear models.


  • Weight-t Translation
  • Weight-l Language model
  • Weight-d distortion (reordering)
  • Weight-w word penalty

Moses was developed in C++ for efficiency and followed modular, object-oriented design.The toolkit is a complete out-of-the-box translation system for academic research. It consists of all the components needed to preprocess data, train the language models and the translation models. It also contains tools for tuning these models using minimum error rate training and evaluating the resulting translations using the BLEU score.
 

 Moses requires two main things
  • Parallel text- Collection of sentences in two different languages, which is sentence-aligned, each sentence in one language is matched with its corresponding translated sentence in the other language.
  • Monolingual target set- A statistical model built using monolingual data in the target language and used by the decoder to try to ensure the fluency of the output.
There are two main components in the Moses
  • Training Pipeline- Take the raw data and turn it into a machine translation model
  • Decoder- Translate the source sentence into the target language
Decoder Modules 
  • Input: This can be a plain sentence, or it can be annotated with xml-like elements to guide the translation process, or it can be a more complex structure like a lattice or confusion network.
  • Translation model: This can use phrase-phrase rules, or hierarchical (perhaps syntactic) rules.
  • Decoding algorithm: Decoding is a huge search problem.
  • Language model: Moses supports several different language model toolkits (SRILM, KenLM, IRSTLM, RandLM)
 The process of Moses system is described in a picture is given below.



 We need to install Moses to train the system and get output. So in the next blog we will see how to install Moses in the Ubuntu operating system.

Monday, January 23, 2017

Enterprise Application Integration and Enterprise Serivce Bus

Enterprise Application Integration
  • Integrating systems and applications together
  • Get software systems to work in perfect synchronism with each other
  • Not limited to integration within an organization
    • Integrating with customer applications
    • Integrating with supplier/partner applications
    • Integrating with public services
By using EAI, we have got another problem that how can we talk to each different services which develop on different technologies, different languages, different protocols, different platforms, different message formats and different QoS requirements (security, reliability). ESB is the rescue for this problem. 

Now we will see how can we use ESB to resolve this problem. Think a real scenario. A Chinese girl is joining who does not know English in your classroom. Think you know only Englis and you don't know Chinese. So how can you communicate with that Chinese girl? In this scenario, you can a friend who knows Chinese and English. Through that, you can easily communicate with that girl. This is cost and time effective as you don't need to study Chinese. 

Now we can apply this solution to the software industry. Let's assume, you are developing a business application for buying a dress. There you need to talk to Sales System, Customer System, and Inventory system. In this example, let's assume sales system built using SOAP protocol (Exposing SOAP services). Customer system using XML based REST services and Inventory system using JSON-based REST services. Now you need to deal with multiple protocols. Here we can use ESB as the rescue. 

What is ESB?

The normal bus is used to transfer from one place to another place. In ESB, you need to pass your message to ESB, ESB will pass your message to a destination. Also if destination sends a response, ESB will take that response and deliver to you. In the previous example, sales system will send the soap message to ESB. ESB will take this message and convert it to XML based REST message to the cusomer system. You may connect to multiple application through ESB. But you only need to do one simple connection which calls ESB only. ESB will talk to rest of the applications.

Introduction to SOA (Service Oriented Architecture)

Hi all,

In this blog, we will see about What is SOA in a simple way with real world examples.

Before coming to the point what is SOA, we need to know why SOA is needed and why it had been evolved. For this, we will go with simple real world example. Think about an old radio. In there everything is integrated such as FM radio, The cassette player, the speaker ... But if we want a double cassette player or CD player, we have to change the whole thing again and again. But with modular applications, each part is independent. We can add other items to the already available thing. There should be a way to communicate with each component.

Let's apply this scenario to the software industry. Initially, we used standalone application which is run on one computer and do one job. Database, UI, everything is in the simple computer. Then there was a requirement that multiple users need to access at the same time. For that, we got Client Server architecture. This means you have the front end on your machine and database logic & rest of the things in the different machine which is called as a server. Every client calls the same server machine. Then requirements had been grown. So people moved to different architecture 'Multi-tier architecture'. The front end is on your machine. Business logic implemented in different server and DB is on another server. After that people decided to go in distributed applications. For example, one application does a part of the job, another application does that's job and the third application does another job. By integrating all these jobs, you can fulfill your requirement. That means different services and different responsibilities owned by the different applications.

Here you have other problem that how can we inter-connect with these applications. Practically application A can run on the Linux which is implemented using JAVA, Application B runs on windows which are implemented in C#. Here JAVA application needs to communicate with the C# application. So we need the new model. To overcome this scenario we came u with SOA model. SOA means Service Oriented Architecture.

So we need to know what is service? When we connect to the application, the application may not expose everything that it can do. But it may expose certain functionalities to the world. For example, Hotel reservation system may expose register, login, get booking details and book rooms. But all other private functions will keep privately. When they expose the functionalities,  we called it as service. We depend on multiple services to achieve a specific goal. This is what service oriented architecture.

"A set of principles and practices for modeling enterprise business functions as services or micro services which have following attributes."

The features of SOA are

  • Standardized: Support open standards.
  • Loose Coupling: Need to give required data to the interface and expects the response. Processing will be handling by the service.
  • Stateless: The Service does not maintain state between invocation
  • Reusable
  • Autonomic
  • Abstract
  • Discoverable
Couples of example for SOA

  • The supply chain management system should keep an eye on the inventory management system
  • Decision support systems cannot help make useful decisions without insight to all the aspects of the business
In next blog, we will see some more about SOA and WSO2 ESB.