A system comprising: one or more processors coupled to a memory; wherein the one or more processors are configured to: generate a plurality of idioms from application of a data mining technique to a plurality of source code programs, an idiom representing a frequently-occurring pattern, an idiom associated with a type and/or method invocation; receive a natural language query for an idiom; obtain a first plurality of source code snippets corresponding to the natural language query from a search engine code snippet storage (204; 1424); obtain a second plurality of source code snippets corresponding to the natural language query from a document embedding database (322; 1444); extract type data and method invocation data that relate to the natural language query from each of the first plurality of source code snippets and each of the second plurality of source code snippets; use the extracted type data and the extracted method invocation data to find one or more idioms matching the extracted type data and/or extracted method invocation data from an idiom cache storage (410; 1456); and return (910; 1206) one or more source code snippet candidates generated from the found one or more idioms, wherein the source code snippets contain idioms or frequently-occurring code patterns for a code fragment for the natural language query. one or more processors coupled to a memory; wherein the one or more processors are configured to: generate a plurality of idioms from application of a data mining technique to a plurality of source code programs, an idiom representing a frequently-occurring pattern, an idiom associated with a type and/or method invocation; receive a natural language query for an idiom; obtain a first plurality of source code snippets corresponding to the natural language query from a search engine code snippet storage (204; 1424); obtain a second plurality of source code snippets corresponding to the natural language query from a document embedding database (322; 1444); extract type data and method invocation data that relate to the natural language query from each of the first plurality of source code snippets and each of the second plurality of source code snippets; use the extracted type data and the extracted method invocation data to find one or more idioms matching the extracted type data and/or extracted method invocation data from an idiom cache storage (410; 1456); and return (910; 1206) one or more source code snippet candidates generated from the found one or more idioms, wherein the source code snippets contain idioms or frequently-occurring code patterns for a code fragment for the natural language query. generate a plurality of idioms from application of a data mining technique to a plurality of source code programs, an idiom representing a frequently-occurring pattern, an idiom associated with a type and/or method invocation; receive a natural language query for an idiom; obtain a first plurality of source code snippets corresponding to the natural language query from a search engine code snippet storage (204; 1424); obtain a second plurality of source code snippets corresponding to the natural language query from a document embedding database (322; 1444); extract type data and method invocation data that relate to the natural language query from each of the first plurality of source code snippets and each of the second plurality of source code snippets; use the extracted type data and the extracted method invocation data to find one or more idioms matching the extracted type data and/or extracted method invocation data from an idiom cache storage (410; 1456); and return (910; 1206) one or more source code snippet candidates generated from the found one or more idioms, wherein the source code snippets contain idioms or frequently-occurring code patterns for a code fragment for the natural language query.