luminoso_api/v5_upload.py
def _simplify_doc(doc):
    """
    Limit a document to just the three fields we should upload.
    """
    # Mutate a copy of the document to fill in missing fields
    doc = dict(doc)
    if 'text' not in doc:
        raise ValueError("The document {!r} has no text field".format(doc))
    return {
        'text': doc['text'],
        'metadata': doc.get('metadata', []),
        'title': doc.get('title', '')
    }
def _simplify_doc(doc):
    """
    Limit a document to just the three fields we should upload.
    """
    # Mutate a copy of the document to fill in missing fields
    doc = dict(doc)
    if 'text' not in doc:
        raise ValueError("The document {!r} has no text field".format(doc))
    return {
        'text': doc['text'],
        'metadata': doc.get('metadata', []),
        'title': doc.get('title', '')
    }
def _simplify_doc ( doc ) : # Mutate a copy of the document to fill in missing fields doc = dict ( doc ) if 'text' not in doc : raise ValueError ( "The document {!r} has no text field" . format ( doc ) ) return { 'text' : doc [ 'text' ] , 'metadata' : doc . get ( 'metadata' , [ ] ) , 'title' : doc . get ( 'title' , '' ) }
Limit a document to just the three fields we should upload.
Limit a document to just the three fields we should upload .