<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# This script, when run, parses the file "swagger.yaml" and strips it down to only
# include those paths and methods specified in the included variable.
#
# As of now, it is called with every "jekyll build" - see jekyll-freme/_plugins/jekyll-pages-directory.rb
# line: "exec(python swagger/yamlscript.py)"
#
# To be able to import yaml, on linux, run "sudo pip install PyYAML"
#
# Author: <NAME> (<EMAIL>)
#


def main():
	import yaml,os
	try:
		with open(os.path.dirname(__file__)+"/swagger.yaml","r") as f:
			full=yaml.load(f.read())
	except IOError:
		print(os.path.dirname(__file__)+"/swagger.yaml could not be found. A simple-API-Doc was not created")
		return 0
		
	included={
	"/e-entity/freme-ner/documents": ["post"],
	"/e-entity/dbpedia-spotlight/documents": ["post"],
	"/e-publishing/html": ["post"],
	"/e-link/documents/": ["post"],
	"/e-translation/tilde": ["post"],	
	}
	
	for path in full["paths"].keys():
		if path not in included:
			del full["paths"][path]
		else:
			for method in included[path]:
				if method not in full["paths"][path].keys():
					del full["paths"][path][method]
				else:
					del full["paths"][path][method]['tags']
	
	full['info']['description']="This section only covers the most important endpoints of FREME: the enrichment endpoints. <br> A full Documentation is provided <a href=\"full.html\"> here  </a>."
	
	
	with open(os.path.dirname(__file__)+"/simple.yaml",'w') as f:
		f.write(yaml.dump(full))
	return 0

if __name__ == '__main__':
	main()
<commit_msg>minor bugfix<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# This script, when run, parses the file "swagger.yaml" and strips it down to only
# include those paths and methods specified in the included variable.
#
# As of now, it is called with every "jekyll build" - see jekyll-freme/_plugins/jekyll-pages-directory.rb
# line: "exec(python swagger/yamlscript.py)"
#
# To be able to import yaml, on linux, run "sudo pip install PyYAML"
#
# Author: <NAME> (<EMAIL>)
#


def main():
	import yaml,os
	try:
		with open(os.path.dirname(__file__)+"/swagger.yaml","r") as f:
			full=yaml.load(f.read())
	except IOError:
		print(os.path.dirname(__file__)+"/swagger.yaml could not be found. A simple-API-Doc was not created")
		return 0
		
	included={
	"/e-entity/freme-ner/documents": ["post"],
	"/e-entity/dbpedia-spotlight/documents": ["post"],
	"/e-publishing/html": ["post"],
	"/e-link/documents/": ["post"],
	"/e-translation/tilde": ["post"],	
	}
	
	for path in full["paths"].keys():
		if path not in included:
			del full["paths"][path]
		else:
			for method in included[path]:
				if method not in full["paths"][path].keys():
					del full["paths"][path][method]
				else:
					full["paths"][path][method]['tags']="Enrichment Endpoints"
	
	full['info']['description']="This section only covers the most important endpoints of FREME: the enrichment endpoints. <br> A full Documentation is provided <a href=\"full.html\"> here  </a>."
	
	
	with open(os.path.dirname(__file__)+"/simple.yaml",'w') as f:
		f.write(yaml.dump(full))
	return 0

if __name__ == '__main__':
	main()

{'fraction_non_alphanumeric': 0.17373417721518988, 'fraction_numerical': 0.0018987341772151898, 'mean_word_length': 4.114886731391586, 'pattern_counts': {'":': 10, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3268517', 'n_tokens_mistral': 1194, 'n_tokens_neox': 1070, 'n_words': 309}