Bing Adds Intelligent Code Search
Written by Kay Ewbank   
Monday, 23 July 2018

There's a new search option in Bing called Code Sample Answer that you can use to find code that matches what you ask for in a question. You describe the code you're looking for, and it is extracted from an article and placed in the requested programming language.

The example given is a question of 'convert case using a function in R', with results then been extracted and a link to the corresponding article. The developers say this isn't limited to programming languages from Microsoft:

"We wanted our solution to support a broad range of programming languages. For Bing to be able to satisfy this requirement and find a corresponding code snippet answering a user’s query, it had to be able to parse and understand those instructions, the syntax and form of the many different programming languages."

In addition, the Bing developers know that a good solution would be able to cope with questions phrased using natural language:

"Bing needs to be able to map the intent of the query (expressed in natural language) to the intent of a code sample (expressed in a programming language) in order to find the most relevant code sample for the query."

The Microsoft team made use of Bing’s Natural Language Processing (NLP) technology and "language agnostic code understanding capabilities" to come up with a solution that did allow natural language queries to be used to ask questions pertaining to many programming languages.


When a query is issued on, it is first classified based on its intent as code or non-code type of query. The search algorithm places high confidence of coding intent to avoid showing code-based answers when people are actually asking non-code questions - Chai or Mocha could be about what drink is preferable, whereas "Chai or Mocha assert” is more obviously about JavaScript testing frameworks.

"In ambiguous cases such as this one, web results will continue to honor all likely intents and the Code Answer may be suppressed. It is only when Bing intelligently detects the coding intent with high confidence that that Code Sample Answer will trigger:"

To avoid incorrect identification of coding queries, the natural language processing pipelines for developers make use of patterns found in training data from developer queries collected over the years containing commonly used terms and text structure typical for coding queries.

The engine then looks at specific syntax, and any API, tool or language names used in the query to work out the language. The system then extracts the best matched code samples from popular, authoritative and well moderated sites like Stackoverflow, Github, W3Schools, MSDN, Tutorialpoints, etc. The solution is chosen by taking into account not only the API and programming language match, but how the solution has been voted in terms of up and down votes, and the completeness of the solution.

It is, of course, possible to get equally good results from a more standard search. It will be interesting to see whether this addition will make developers choose Bing for searching over other search options.





More Information

Sample Bing Search for convert case using a function in R

Bing Blog On Code Search

Related Articles

Bing As A Platform

Search Engines

Google Now Helps You Search For || And More

RankBrain - AI Comes To Google Search 

Hummingbird - A New Google Search Algorithm       

Google Search Goes Semantic - The Knowledge Graph       

Google Needs a New Search Algorithm

Google's War On Links - Prohibition All Over Again

Focus on Google Search

How does Google search?  

Google Explains How AI Photo Search Works       

The Myth of Search 


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.



ACM Adopts Open Access Publishing Model

ACM, the Association for Computing Machinery, the professional body for computer scientists, has relaunched Communications of the ACM, the organization’s flagship magazine, as a web-first  [ ... ]

GR00T Could Be The Robot You Have Always Wanted

We may not have flying cars, but we could well soon have robots that match up to predictions for the 21st century. Nvidia has announced GR00T, a cleverly named project to build robots using foundation [ ... ]

More News


raspberry pi books



or email your comment to:

Last Updated ( Monday, 23 July 2018 )