Search "mapping from" for knowledge.
9274
def search_list(kb, from_=None, match_type=None,
                    page=None, per_page=None, unique=False):
        """"""
        # init
        page = page or 1
        per_page = per_page or 10

        if kb.kbtype == models.KnwKB.KNWKB_TYPES['written_as']:
            # get the base query
            query = api.query_kb_mappings(
                kbid=kb.id,
                key=from_ or '',
                match_type=match_type or 's'
            ).with_entities(models.KnwKBRVAL.m_key)
            # if you want a 'unique' list
            if unique:
                query = query.distinct()
            # run query and paginate
            return [item.m_key for item in
                    pagination.RestfulSQLAlchemyPagination(
                        query, page=page or 1,
                        per_page=per_page or 10
                    ).items]
        return []
1046556
private static Mapping getStringMapping(KeyInformation information) {
        assert AttributeUtil.isString(information.getDataType());
        Mapping map = getMapping(information);
        if (map== DEFAULT) map = TEXT;
        return map;
    }
454620
def expand_mapping_target(namespaces, val):
    """"""

    vals = [v.strip() for v in val.split(',')]
    ret = []
    for v in vals:
        inverse = False
        if v.startswith('^'):
            inverse = True
            v = v[1:]
        ret.append((expand_curielike(namespaces, v), inverse))
    return ret
401599
Map<String, Double> findMatchQueries(
      String matchedWordsString, Map<String, String> collectExpandedQueryMap) {
    Map<String, Double> qualifiedQueries = new HashMap<>();
    Set<String> matchedWords = splitIntoTerms(matchedWordsString);
    for (Entry<String, String> entry : collectExpandedQueryMap.entrySet()) {
      Set<String> wordsInQuery = splitIntoTerms(entry.getKey());
      if (wordsInQuery.containsAll(matchedWords)) {
        qualifiedQueries.put(
            entry.getKey(),
            NGramDistanceAlgorithm.stringMatching(matchedWordsString, entry.getKey()));
      }
    }
    return qualifiedQueries;
  }
1298416
def from_mapping(cls, mapping):
		
		out = cls()
		for elem, count in mapping.items():
			out._set_count(elem, count)
		return out
349691
def map_statements(self):
        """"""
        for stmt in self.statements:
            for agent in stmt.agent_list():
                if agent is None:
                    continue
                all_mappings = []
                for db_name, db_id in agent.db_refs.items():
                    if isinstance(db_id, list):
                        db_id = db_id[0][0]
                    mappings = self._map_id(db_name, db_id)
                    all_mappings += mappings
                for map_db_name, map_db_id, score, orig_db_name in all_mappings:
                    if map_db_name in agent.db_refs:
                        continue
                    if self.scored:
                        # If the original one is a scored grounding,
                        # we take that score and multiply it with the mapping
                        # score. Otherwise we assume the original score is 1.
                        try:
                            orig_score = agent.db_refs[orig_db_name][0][1]
                        except Exception:
                            orig_score = 1.0
                        agent.db_refs[map_db_name] = \
                            [(map_db_id, score * orig_score)]
                    else:
                        if map_db_name in ('UN', 'HUME'):
                            agent.db_refs[map_db_name] = [(map_db_id, 1.0)]
                        else:
                            agent.db_refs[map_db_name] = map_db_id
896875
private int getMapping(final String mapping, final int revisionCounter)
    {

        String tempA, tempB;

        int length = 0;
        int revC = -1, mapC = -1;
        int index, max = mapping.length();

        while (length < max && revC < revisionCounter) {

            // Read revisionCounter
            index = mapping.indexOf(' ', length);
            tempA = mapping.substring(length, index);
            length = index + 1;

            // Read mappedCounter
            index = mapping.indexOf(' ', length);
            if (index == -1) {
                index = mapping.length();
            }
            tempB = mapping.substring(length, index);
            length = index + 1;

            // Parse values
            revC = Integer.parseInt(tempA);
            mapC = Integer.parseInt(tempB);

            // System.out.println(revC + " -> " + mapC);
        }

        if (revC == revisionCounter) {
            // System.out.println(revC + " >> " + mapC);
            return mapC;
        }

        return revisionCounter;
    }
1308968
def _create_request_map(cls, input_map):
        """"""
        mapped = super(Certificate, cls)._create_request_map(input_map)
        if mapped.get('service') == CertificateType.developer:
            mapped['service'] = CertificateType.bootstrap
        return mapped
619039
def search(self, keyword):
        
        params = {
            "source": "map",
            "description": keyword
        }
        data = self._request(ENDPOINTS['SEARCH'], params)
        data['result_data'] = [res for res in data['result_data'] if isinstance(res, dict)]
        return data
363583
def do_map(input_dict, feature_format, positive_class=None):
    '''
    
    '''
    # Context of the unseen example(s)
    train_context = input_dict['train_ctx']
    test_context = input_dict['test_ctx']

    # Currently known examples & background knowledge
    features = input_dict['features']
    format = input_dict['output_format']

    evaluations = domain_map(features, feature_format, train_context,
                             test_context, format=format,
                             positive_class=positive_class)
    return {'evaluations': evaluations}
844464
def map_parameters(cls, params):
        """"""

        d = {}
        for k, v in six.iteritems(params):
            d[cls.FIELD_MAP.get(k.lower(), k)] = v
        return d
802014
def _index_and_mapping(self, namespace):
        """"""
        index, doc_type = namespace.split(".", 1)
        return index.lower(), doc_type
897960
def bsearch_mappings(mappings, offset, from = 0, to = mappings.size - 1)
      mid = (from + to) / 2

      if from > to
        return from < 1 ? nil : mappings[from-1]
      end

      case compare_source_offsets(offset, mappings[mid][:generated])
      when 0
        mappings[mid]
      when -1
        bsearch_mappings(mappings, offset, from, mid - 1)
      when 1
        bsearch_mappings(mappings, offset, mid + 1, to)
      end
    end
389081
def find(cls, *args, **kwargs):
        """"""
        return cls.from_cursor(cls.collection.find(*args, **kwargs))
1285601
def map_init(interface, params):
    """"""
    import numpy as np
    import random
    np.random.seed(params['seed'])
    random.seed(params['seed'])
    return params
555723
def map(self, options=None):
        """"""
        for path, data in self.paths.items():
            for obj in self.create_class(data, options=options):
                self.add_object(obj)
912841
Set<String> searchInstancesContainingKey(String searchKey)
            throws KnowledgeSourceReadException {
        return getFromProtege(searchKey,
                new ProtegeCommand<Set<String>, String>(
                        "search instance in a given  slot") {
                    @Override
                    Set<String> get(String matchString) {
                        Set<String> searchResults = new HashSet<>();
                        try {
                            Collection<Frame> displayNameMatches = protegeKnowledgeBase
                                    .getMatchingFrames(protegeKnowledgeBase
                                            .getSlot("displayName"), null, false,
                                            "*" + matchString.trim() + "*", -1);
                            Collection<Frame> nameMatches = protegeKnowledgeBase
                                    .getMatchingFrames(protegeKnowledgeBase
                                            .getSlot(":NAME"), null, false, "*"
                                            + matchString.trim() + "*", -1);
                            Slot nameSlot = protegeKnowledgeBase.getSlot(":NAME");
                            Cls propositionCls = protegeKnowledgeBase.getCls("Proposition");
                            if (displayNameMatches != null) {
                                for (Frame match : displayNameMatches)
                                    if (match instanceof Instance) {
                                        Instance temp = (Instance) match;
                                        if (temp.hasType(propositionCls)) {
                                            searchResults.add((String) getOwnSlotValue(match, nameSlot));
                                        }
                                    }
                            }
                            if (nameMatches != null) {
                                for (Frame match : nameMatches) {
                                    if (match instanceof Instance) {
                                        Instance temp = (Instance) match;
                                        if (temp.hasType(propositionCls)) {
                                            String result = (String) getOwnSlotValue(match, nameSlot);
                                            if (!searchResults.contains(result))
                                                searchResults.add(result);
                                        }
                                    }
                                }
                            }
                        } catch (KnowledgeSourceReadException e) {
                            e.printStackTrace();
                        }
                        return searchResults;
                    }
                });
    }