Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)

        def read_json_stream(filename_or_stream):
    """
    Read a stream of data in "JSON stream" format. Returns a generator of the
    decoded objects.
    """
    if hasattr(filename_or_stream, 'read'):
        stream = filename_or_stream
    else:
        stream = codecs.open(filename_or_stream, encoding='utf-8')
    for line in stream:
        line = line.strip()
        if line:
            yield json.loads(line)
        


src/c/o/ConceptNet-5.2.2/conceptnet5/readers/conceptnet4.py   ConceptNet(Download)
"""
 
from conceptnet5.formats.json_stream import JSONStreamWriter, read_json_stream
from conceptnet5.nodes import normalized_concept_uri
from conceptnet5.edges import make_edge
    def transform_file(self, input_filename, output_file):
        out = JSONStreamWriter(output_file)
        for obj in read_json_stream(input_filename):
            for new_obj in self.handle_assertion(obj):
                out.write(new_obj)

src/c/o/conceptnet5-HEAD/conceptnet5/readers/conceptnet4.py   conceptnet5(Download)
"""
 
from conceptnet5.formats.json_stream import JSONStreamWriter, read_json_stream
from conceptnet5.nodes import normalized_concept_uri
from conceptnet5.edges import make_edge
    def transform_file(self, input_filename, output_file):
        out = JSONStreamWriter(output_file)
        for obj in read_json_stream(input_filename):
            for new_obj in self.handle_assertion(obj):
                out.write(new_obj)