Skip to content

Commit

Permalink
finish classify option
Browse files Browse the repository at this point in the history
  • Loading branch information
kermitt2 committed Jan 28, 2024
1 parent bf19c65 commit 2e6b159
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ Copyright © 2022 The Author(s). This is an open access article distributed unde
"© 2022 Gyurchev, Coral-Medina, Weening, Almayouf, Kuijpers, Nevoigt and Louis. This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.",authors,CC-BY
"© 2022 Ballutaud et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.",authors,CC-BY
"This is an open access article under the terms of the Creative Commons Attribution License, which permits use, distribution and reproduction in any medium, provided the original work is properly cited. © 2022 The Authors. Global Change Biology published by John Wiley & Sons Ltd.",authors
© The Author(s) 2023,authors,CC-BY
© The Author(s) 2023,authors,undecided
"© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).",authors,CC-BY
"© The Author(s) 2022. Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article' s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article' s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http:// creat iveco mmons. org/ licen ses/ by/4. 0/. The Creative Commons Public Domain Dedication waiver (http:// creat iveco mmons. org/ publi cdoma in/ zero/1. 0/) applies to the data made available in this article, unless otherwise stated in a credit line to the data.",authors,CC-BY
"© The Author(s) 2021. Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article' s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article' s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http:// creat iveco mmons. org/ licen ses/ by/4. 0/. The Creative Commons Public Domain Dedication waiver (http:// creat iveco mmons. org/ publi cdoma in/ zero/1. 0/) applies to the data made available in this article, unless otherwise stated in a credit line to the data.",authors,CC-BY
Expand Down
16 changes: 8 additions & 8 deletions delft/applications/licenseClassifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,14 @@ def classify(texts, output_format, embeddings_name=None, architecture="gru", tra
model = Classifier('license_'+architecture)
model.load()
result2 = model.predict(texts, output_format)
#result[] = result2[]

runtime = round(time.time() - start_time, 3)
if output_format == 'json':
result["runtime"] = runtime
else:
print("runtime: %s seconds " % (runtime))

return result
return result, result2


def _read_data(file_path, data_type="copyrights"):
Expand Down Expand Up @@ -432,9 +432,9 @@ def report_training_copyrights(y):
y_test = train_and_eval_binary(embeddings_name, args.fold_count, architecture=architecture, transformer=transformer)

if args.action == 'classify':
someTexts = ['',
'',
'']
result = classify(someTexts, "json", architecture=architecture, embeddings_name=embeddings_name, transformer=transformer)
print(json.dumps(result, sort_keys=False, indent=4, ensure_ascii=False))

someTexts = ['© 2005 Elsevier Inc. All rights reserved.',
'This is an open-access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by-nc/4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. Copyright © 2022 The Korean Association for Radiation Protection.',
'© The Author(s) 2023.']
result1, result2 = classify(someTexts, "json", architecture=architecture, embeddings_name=embeddings_name, transformer=transformer)
print(json.dumps(result1, sort_keys=False, indent=4, ensure_ascii=False))
print(json.dumps(result2, sort_keys=False, indent=4, ensure_ascii=False))

0 comments on commit 2e6b159

Please sign in to comment.