examples : examples example
542111
def p_examples_add(self, p):
        ''
        p[0] = p[1]
        if p[2].label in p[0]:
            existing_ex = p[0][p[2].label]
            self.errors.append(
                ("Example with label '%s' already defined on line %d." %
                 (existing_ex.label, existing_ex.lineno),
                 p[2].lineno, p[2].path))
        p[0][p[2].label] = p[2]
264813
def p_examples_create(self, p):
        """"""
        p[0] = OrderedDict()
        if p[1] is not None:
            p[0][p[1].label] = p[1]
117603
def filter_examples(self, field_names):
        
        for i, example in enumerate(self.examples):
            for field_name in field_names:
                vocab = set(self.fields[field_name].vocab.stoi)
                text = getattr(example, field_name)
                example_part = [word for word in text if word in vocab]
                setattr(example, field_name, example_part)
            self.examples[i] = example
522071
def examples():
    ''' 
    '''
    sci = InterLexClient(
        api_key = os.environ.get('INTERLEX_API_KEY'),
        base_url = 'https://beta.scicrunch.org/api/1/', # NEVER CHANGE
    )
    entity = {
        'label': 'brain115',
        'type': 'fde', # broken at the moment NEEDS PDE HARDCODED
        'definition': 'Part of the central nervous system',
        'comment': 'Cannot live without it',
        'superclass': {
            'ilx_id': 'ilx_0108124', # ILX ID for Organ
        },
        'synonyms': [
            {
                'literal': 'Encephalon'
            },
            {
                'literal': 'Cerebro'
            },
        ],
        'existing_ids': [
            {
                'iri': 'http://uri.neuinfo.org/nif/nifstd/birnlex_796',
                'curie': 'BIRNLEX:796',
            },
        ],
    }
    simple_entity = {
        'label': entity['label'],
        'type': entity['type'], # broken at the moment NEEDS PDE HARDCODED
        'definition': entity['definition'],
        'comment': entity['comment'],
        'superclass': entity['superclass']['ilx_id'],
        'synonyms': [syn['literal'] for syn in entity['synonyms']],
        'predicates': {'tmp_0381624': 'http://example_dbxref'}
    }
    annotation = {
        'term_ilx_id': 'ilx_0101431', # brain ILX ID
        'annotation_type_ilx_id': 'tmp_0381624', # hasDbXref ILX ID
        'annotation_value': 'PMID:12345',
    }
    relationship = {
        'entity1_ilx': 'ilx_0101431', # brain
        'relationship_ilx': 'ilx_0115023', # Related to
        'entity2_ilx': 'ilx_0108124', #organ
    }
    update_entity_data = {
        'ilx_id': 'ilx_0101431',
        'label': 'Brain',
        'definition': 'update_test!!',
        'type': 'fde',
        'comment': 'test comment',
        'superclass': 'ilx_0108124',
        'synonyms': ['test', 'test2', 'test2'],
    }
    # resp = sci.delete_annotation(**{
    #     'term_ilx_id': 'ilx_0101431', # brain ILX ID
    #     'annotation_type_ilx_id': 'ilx_0115071', # hasConstraint ILX ID
    #     'annotation_value': 'test_12345',
    # })
    relationship = {
        'entity1_ilx': 'http://uri.interlex.org/base/ilx_0100001', # (R)N6 chemical ILX ID
        'relationship_ilx': 'http://uri.interlex.org/base/ilx_0112772', # Afferent projection ILX ID
        'entity2_ilx': 'http://uri.interlex.org/base/ilx_0100000', #1,2-Dibromo chemical ILX ID
    }
1164470
def generate_example(self):
        
        data = javabridge.call(self.jobject, "generateExample", "()Lweka/core/Instance;")
        if data is None:
            return None
        else:
            return Instance(data)
846716
function(example) {
    if (example.labels == null || example.words == null) {
      throw new Error('We tried learning an invalid example: "' + example + '"')
    }
    this.root.add(example)
    example.labels.forEach(label => {
      if (this.numExamples.get(label)) {
        let count = this.numExamples.get(label)
        this.numExamples.set(label, count + 1)
      } else {
        this.numExamples.set(label, 1)
      }
    })
    this.weightsNeedBuilding = true
  }
28530
def create_new_example(foo='', a='', b=''):
    
    return Example.__create__(foo=foo, a=a, b=b)
592187
public static List<StringContext> getContextsFromExamples(List<CcgExample> examples) {
    List<StringContext> contexts = Lists.newArrayList();
    for (CcgExample example : examples) {
      AnnotatedSentence sentence = example.getSentence();
      int numTerminals = sentence.size();
      for (int i = 0; i < numTerminals; i++) {
        for (int j = i; j < numTerminals; j++) {
          contexts.add(new StringContext(i, j, sentence));
        }
      }
    }
    return contexts;
  }
1046630
def create_examples(candidate_dialog_paths, examples_num, creator_function):
    
    i = 0
    examples = []
    unique_dialogs_num = len(candidate_dialog_paths)

    while i < examples_num:
        context_dialog = candidate_dialog_paths[i % unique_dialogs_num]
        # counter for tracking progress
        if i % 1000 == 0:
            print str(i)
        i += 1

        examples.append(creator_function(context_dialog, candidate_dialog_paths))

    return examples
984320
def examples(self):
        """"""
        hello_str = 'hello'[:self.length]
        hello_str += ' ' * (self.length - len(hello_str))
        world_str = 'world'[:self.length]
        world_str += ' ' * (self.length - len(world_str))
        return [('hello', hello_str), ('world', world_str)]
1329757
def examples(self):
         
        examples = []
        for example in [variant.examples for variant in self._raw_synset.variants if len(variant.examples)]:
            examples.extend(example)
        return examples
1246306
def examples(directory):
    
    source_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "examples")

    try:
        shutil.copytree(source_dir, os.path.join(directory, "examples"))
    except OSError as e:
        if e.errno == errno.EEXIST:
            six.print_("Folder examples is exists.")
594918
def example_all():
    
    my_file = FileAsObj()
    my_file.filename = '/tmp/example_file.txt'
    my_file.add('# First change!')
    my_file.save()
    my_file = FileAsObj('/tmp/example_file.txt')
    my_file.unique = True
    my_file.sorted = True
    my_file.add('1')
    my_file.add('1')
    my_file.add('2')
    my_file.add('20 foo')
    my_file.add('200 bar')
    my_file.add('# Comment')
    my_file.unique = False
    my_file.add('# Comment')
    my_file.add('# Comment')
    my_file.unique = True
    my_file.rm(my_file.egrep('^#.*'))
    my_file.rm(my_file.grep('foo'))
    my_file.replace(my_file.egrep('^2'), 'This line was replaced.')
    print(my_file)
    print(my_file.log)
1262362
function example() {
  return function(data, render) {
    var output = '.. code-block:: javascript\n';
    var lines = render(data).split('\n');
    logger.debug('line-0', data);
    if (lines.length && lines[0].match(/^<caption>.*<\/caption>$/)) {
      output += '   :caption: ' + lines.shift().slice(9, -10) + '\n';
    }
    output += '\n';
    for (var i = 0; i < lines.length; i++) {
      output += '   ' + lines[i] + '\n';
    }
    return render(output);
  };
}
641211
def p_example(self, p):
        """"""
        if len(p) > 4:
            seen_fields = set()
            for example_field in p[6]:
                if example_field.name in seen_fields:
                    self.errors.append(
                        ("Example with label '%s' defines field '%s' more "
                        "than once." % (p[2], example_field.name),
                        p.lineno(1), self.path))
                seen_fields.add(example_field.name)
            p[0] = AstExample(
                self.path, p.lineno(1), p.lexpos(1), p[2], p[5],
                OrderedDict((f.name, f) for f in p[6]))
        else:
            p[0] = AstExample(
                self.path, p.lineno(1), p.lexpos(1), p[2], None, OrderedDict())
741503
def show_examples():
    
    first, last = create_name()
    add = create_street()
    zip, city, state = create_city_state_zip()
    phone = create_phone(zip)
    print(first, last)
    print(add)
    print("{0:s} {1:s} {2:s}".format(city, state, zip))
    print(phone)
    print(create_sentence())
    print(create_paragraphs(num=3))
    print(create_cc_number())
    expiry = create_date(max_years_future=3)
    print("{0:%m/%y}".format(expiry))
    print(create_email(name=(first, last)))
    print("Password: {0:s}".format(create_pw()))
    print(create_company_name())
    print(create_job_title())
    print("Born on {0:%m/%d/%Y}".format(create_birthday()))
924314
protected function createExamples()
    {
        $examples = array();
        foreach ($this->table->getColumnsHash() as $rowNum => $row) {
            $examples[] = new ExampleNode(
                $this->table->getRowAsString($rowNum + 1),
                $this->tags,
                $this->getSteps(),
                $row,
                $this->table->getRowLine($rowNum + 1),
                $this->getTitle()
            );
        }

        return $examples;
    }