def analyze_syntax(text):
 credentials = GoogleCredentials.get_application_default()
 scoped_credentials = credentials.create_scoped(['https://www.googleapis.com/auth/cloud-platform'])
 http = httplib2.Http()
 scoped_credentials.authorize(http)
 service = discovery.build('language', 'v1beta1', http=http)
 body = {'document': {'type': 'PLAIN_TEXT', 'content': text}, 'features': {'extract_syntax': True}, 'encodingType': get_native_encoding_type()}
 request = service.documents().annotateText(body=body)
 return request.execute()

def analyze_syntax ( text ) : credentials = GoogleCredentials . get_application_default ( ) scoped_credentials = credentials . create_scoped ( [ 'https://www.googleapis.com/auth/cloud-platform' ] ) http = httplib2 . Http ( ) scoped_credentials . authorize ( http ) service = discovery . build ( 'language' , 'v1beta1' , http = http ) body = { 'document' : { 'type' : 'PLAIN_TEXT' , 'content' : text } , 'features' : { 'extract_syntax' : True } , 'encodingType' : get_native_encoding_type ( ) } request = service . documents ( ) . annotateText ( body = body ) return request . execute ( )
use the nl api to analyze the given text string .