From 07456ded61daa495298c3d868cb9ef4cc1a384d5 Mon Sep 17 00:00:00 2001 From: Aritra Dey Date: Wed, 26 Feb 2025 00:29:09 +0530 Subject: [PATCH 1/2] feat: ddd SPDX IDs to repository files --- .editorconfig | 1 + .gitattributes | 1 + Bylaws.md | 2 + README.md | 32 +++++++++ app_spdx_ids.py | 81 ++++++++++++++++++++++ brochure/README.md | 2 + posters/eamt-2016/README.md | 1 + posters/eamt-2016/apertium-at-eamt2016.tex | 1 + posters/eamt-2016/beamerthemeAyuTra.sty | 45 ++++++------ posters/lt4all/Makefile | 6 +- posters/lt4all/apertium-at-lt4all.tex | 39 ++++++----- posters/lt4all/beamerthemeAyuTra.sty | 13 ++-- 12 files changed, 175 insertions(+), 49 deletions(-) create mode 100644 app_spdx_ids.py diff --git a/.editorconfig b/.editorconfig index 0fb80cf..953f841 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-3.0-or-later # http://editorconfig.org/ root = yes diff --git a/.gitattributes b/.gitattributes index 24cc323..474530e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-3.0-or-later * text eol=lf *.jpg binary *.odt binary diff --git a/Bylaws.md b/Bylaws.md index 632708a..588f103 100644 --- a/Bylaws.md +++ b/Bylaws.md @@ -1,3 +1,5 @@ + + # Apertium Bylaws ## Mission diff --git a/README.md b/README.md index f4095fe..4e0be5a 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,35 @@ This is a placeholder for whatever we make the introductory and formal entry-poi * [Issues suitable for newcomers](https://github.com/issues?q=is%3Aopen+is%3Aissue+org%3Aapertium+archived%3Afalse+label%3A%22good+first+issue%22) ([un-authed link](https://github.com/search?q=org%3Aapertium+label%3A%22good+first+issue%22&state=open&type=Issues)) * [Open issues across Apertium](https://github.com/issues?q=is%3Aopen+is%3Aissue+org%3Aapertium+archived%3Afalse) ([un-authed link](https://github.com/search?q=org%3Aapertium&state=open&type=Issues)) * [Open pull requests](https://github.com/issues?q=is%3Aopen+is%3Apr+org%3Aapertium+archived%3Afalse) ([un-authed link](https://github.com/search?q=org%3Aapertium+type%3apr&state=open&type=Issues)) + +## Helper Script for Adding SPDX IDs + +We have created a helper script named `add_spdx_ids.py` to automatically add SPDX IDs to files based on their file type and existing license information. This script helps ensure that all files in the repository have the appropriate SPDX IDs. + +### Usage Instructions + +To use the `add_spdx_ids.py` script, follow these steps: + +1. Ensure you have Python installed on your system. +2. Download the `add_spdx_ids.py` script from the repository. +3. Open a terminal or command prompt. +4. Navigate to the directory where the script is located. +5. Run the script with the file path as an argument: + + ```sh + python add_spdx_ids.py + ``` + + Replace `` with the path to the file you want to add the SPDX ID to. + +### Example + +```sh +python add_spdx_ids.py README.md +``` + +This command will add the appropriate SPDX ID to the `README.md` file. + +### Dependencies + +The `add_spdx_ids.py` script requires Python 3.x to run. Ensure you have Python 3.x installed on your system before running the script. diff --git a/app_spdx_ids.py b/app_spdx_ids.py new file mode 100644 index 0000000..3caa9f8 --- /dev/null +++ b/app_spdx_ids.py @@ -0,0 +1,81 @@ +import sys +import os +import logging + +# Set up logging +logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') + +# Define comment styles for different file types +xml_comment = '\n' +hfst_comment = '! %s\n' +cpp_comment = '// %s\n' +other_comment = '# %s\n' + +# Define SPDX license identifiers +license_identifiers = { + 'GPL-3.0-or-later': 'SPDX-License-Identifier: GPL-3.0-or-later', + 'GPL-2.0-or-later': 'SPDX-License-Identifier: GPL-2.0-or-later', + 'GPL-3.0-only': 'SPDX-License-Identifier: GPL-3.0-only', + 'CC0-1.0': 'SPDX-License-Identifier: CC0-1.0' +} + +def get_license_identifier(file_path): + # Check for existing license in the file + with open(file_path, 'r') as f: + lines = f.readlines() + for line in lines: + for license_id in license_identifiers.values(): + if license_id in line: + return license_id + + # Check for existing license in the repository COPYING file + repo_root = os.path.dirname(os.path.abspath(file_path)) + copying_file = os.path.join(repo_root, 'COPYING') + if os.path.exists(copying_file): + with open(copying_file, 'r') as f: + content = f.read() + for license_id in license_identifiers.values(): + if license_id in content: + return license_id + + # Default to GPL-3.0-or-later if no existing license is found + return license_identifiers['GPL-3.0-or-later'] + +def add_spdx_id(file_path): + ext = os.path.splitext(file_path)[-1] + license_id = get_license_identifier(file_path) + lines = [] + + with open(file_path, 'r') as f: + lines = f.readlines() + + if ext in ['.xml', '.svg']: + if '\n') + lines.insert(1, xml_comment % license_id) + elif ext in ['.hfst']: + lines.insert(0, hfst_comment % license_id) + elif ext in ['.cpp', '.c', '.h']: + lines.insert(0, cpp_comment % license_id) + else: + n = 0 + if lines[0].startswith('#!/'): + n = 1 + lines.insert(n, other_comment % license_id) + + with open(file_path, 'w') as f: + f.write(''.join(lines)) + + logging.info(f'Added SPDX ID to {file_path}') + +if __name__ == '__main__': + if len(sys.argv) < 2: + logging.error('Usage: python add_spdx_ids.py ') + sys.exit(1) + + file_path = sys.argv[1] + if not os.path.exists(file_path): + logging.error(f'File not found: {file_path}') + sys.exit(1) + + add_spdx_id(file_path) diff --git a/brochure/README.md b/brochure/README.md index 0965c77..8b13316 100644 --- a/brochure/README.md +++ b/brochure/README.md @@ -1,3 +1,5 @@ + + # Apertium brochure The Apertium 2-sided A4 brochure (for conferences and other events) needs to be updated periodically. diff --git a/posters/eamt-2016/README.md b/posters/eamt-2016/README.md index 21b4bc9..4542a96 100644 --- a/posters/eamt-2016/README.md +++ b/posters/eamt-2016/README.md @@ -1 +1,2 @@ + # EAMT 2016 Apertium poster, recovered from Overleaf. diff --git a/posters/eamt-2016/apertium-at-eamt2016.tex b/posters/eamt-2016/apertium-at-eamt2016.tex index d8018fd..8a20dd0 100644 --- a/posters/eamt-2016/apertium-at-eamt2016.tex +++ b/posters/eamt-2016/apertium-at-eamt2016.tex @@ -1,3 +1,4 @@ +% SPDX-License-Identifier: GPL-3.0-or-later \documentclass[final]{beamer} % beamer 3.10: do NOT use option hyperref={pdfpagelabels=false} ! %\documentclass[final,hyperref={pdfpagelabels=false}]{beamer} % beamer 3.07: get rid of beamer warnings \mode { %% check http://www-i6.informatik.rwth-aachen.de/~dreuw/latexbeamerposter.php for examples diff --git a/posters/eamt-2016/beamerthemeAyuTra.sty b/posters/eamt-2016/beamerthemeAyuTra.sty index d8c66eb..25c46fb 100644 --- a/posters/eamt-2016/beamerthemeAyuTra.sty +++ b/posters/eamt-2016/beamerthemeAyuTra.sty @@ -1,3 +1,4 @@ +% SPDX-License-Identifier: GPL-3.0-or-later \ProvidesPackage{beamerthemeAyuTra} % this is a style was created by Nikola Ljubešić %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -97,50 +98,50 @@ size=\normalsize} \end{column} \begin{column}{.17\paperwidth} \vskip4ex - \begin{center} +
\includegraphics[width=\linewidth]{Images/apertium_open_box_lower.jpg} - \end{center} +
- \end{column} - \begin{column}{.02\paperwidth} - \end{column} - \end{columns} - \end{beamercolorbox} + +# Apertium poster for LT4All +4-6 December 2019, UNESCO, Paris. +In progress. diff --git a/posters/lt4all/apertium-at-lt4all.tex b/posters/lt4all/apertium-at-lt4all.tex index fc39c36..cf957d3 100644 --- a/posters/lt4all/apertium-at-lt4all.tex +++ b/posters/lt4all/apertium-at-lt4all.tex @@ -1,3 +1,4 @@ +% SPDX-License-Identifier: GPL-3.0-or-later \documentclass[final]{beamer} % beamer 3.10: do NOT use option hyperref={pdfpagelabels=false} ! %\documentclass[final,hyperref={pdfpagelabels=false}]{beamer} % beamer 3.07: get rid of beamer warnings \mode { %% check http://www-i6.informatik.rwth-aachen.de/~dreuw/latexbeamerposter.php for examples @@ -447,7 +448,7 @@ \end{column} - \begin{column}{.49\textwidth} + \ begin{column}{.49\textwidth} @@ -457,17 +458,17 @@ \textbf{Data sets:} English segments (\(S\)) translated into Spanish (\(\mathrm{MT}(S)\)) with MTQE labels (``GOOD'' and ``BAD'') and a collection of \textbf{baseline} features: - \begin{table} + \ begin{table} \centering - \begin{tabular}{lp{1cm}rp{1cm}cp{1cm}c} + \ begin{tabular}{lp{1cm}rp{1cm}cp{1cm}c} \toprule \textbf{data set} & & \textbf{size} & & \textbf{baseline features} & & \textbf{MTQE labels} \\ \midrule training & & 11,272 & & \cmark & & \cmark \\ development & & 1,000 & & \cmark & & \cmark \\ test & & 1,817 & & \cmark & & \xmark \\ \hline \bottomrule - \end{tabular} - \end{table} + \ end{tabular} + \ end{table} \vspace{1cm} @@ -500,54 +501,54 @@ \vspace{-1cm} - \begin{table} + \ begin{table} \centering - \begin{tabular}{lp{1cm}rrrp{1cm}rrrp{1cm}r} + \ begin{tabular}{lp{1cm}rrrp{1cm}rrrp{1cm}r} \toprule \textbf{System} & & $P^{\mathrm{BAD}}$ & $R^{\mathrm{BAD}}$ & $F_1^{\mathrm{BAD}}$ & & $P^{\mathrm{GOOD}}$ & $R^{\mathrm{GOOD}}$ & $F_1^{\mathrm{GOOD}}$ & & $F_1^{w}$ \\ \midrule SBI & & 31.2\% & 63.7\% & 41.9\% & & 88.5\% & 66.7\% & 76.1\% & & 69.5\% \\ \vspace{2mm} SBI+baseline & & 33.4\% & 60.9\% & 43.1\% & & 88.5\% & 71.1\% & 78.8\% & & 72.0\% \\ \hline \bottomrule - \end{tabular} + \ end{tabular} \label{tb:results} - \end{table} + \ end{table} Results on the \textbf{test set}: \vspace{-1cm} - \begin{table} + \ begin{table} \centering - \begin{tabular}{lp{1cm}rrrp{1cm}rrrp{1cm}r} + \ begin{tabular}{lp{1cm}rrrp{1cm}rrrp{1cm}r} \toprule \textbf{System} & & $P^{\mathrm{BAD}}$ & $R^{\mathrm{BAD}}$ & $F_1^{\mathrm{BAD}}$ & & $P^{\mathrm{GOOD}}$ & $R^{\mathrm{GOOD}}$ & $F_1^{\mathrm{GOOD}}$ & & $F_1^{w}$ \\ \midrule baseline & & --- & --- & 16.8\% & & --- & --- & 88.9\% & & 75.3\% \\ SBI & & 30.8\% & 63.9\% & 41.5\% & & 88.8\% & 66.5\% & 76.1\% & & 69.5\% \\ SBI+baseline & & 32.6\% & 63.6\% & 43.1\% & & 89.1\% & 69.5\% & 78.1\% & & 71.5\% \\ \hline \bottomrule - \end{tabular} + \ end{tabular} \label{tb:results} - \end{table} + \ end{table} - \begin{itemize} + \ begin{itemize} \item \emph{baseline:} organizers' baseline using linear regression classification on the baseline features \item \emph{SBI:} using only features from sources of bilingual information \item \emph{SBI+baseline:} combining features from sources of bilingual information and baseline features - \end{itemize} + \ end{itemize} \end{block} } \vbox to .125\textheight{% \begin{block}{{\LARGE \ding{187}} Highlights} - \begin{itemize} + \ begin{itemize} \item SBI system ranked \textbf{3rd} and SBI+baseline system ranked \textbf{1st} in the task \item Our system uses only online available sources of bilingual information \item The method is \textbf{system independent}: can be used on any kind of MT system output \item Any \textbf{other sources of bilingual information} can be easily added - \end{itemize} + \ end{itemize} \end{block} } @@ -568,11 +569,11 @@ \includegraphics[scale=0.54]{Images/logo_Marie_Curie_Actions.jpg} \hspace{3cm} \includegraphics[scale=1.3]{Images/Logotipo_del_Ministerio_de_Ciencia.png} \end{figure} - %\begin{itemize} + %\ begin{itemize} % \setlength{\itemindent}{1em} % \item Spanish government, project TIN2012-32615 (AyuTra) % \item European Commission, project PIAP-GA-2012-324414 (Abu-MaTran) - %\end{itemize} + %\ end{itemize} \end{block} } diff --git a/posters/lt4all/beamerthemeAyuTra.sty b/posters/lt4all/beamerthemeAyuTra.sty index d8c66eb..282175e 100644 --- a/posters/lt4all/beamerthemeAyuTra.sty +++ b/posters/lt4all/beamerthemeAyuTra.sty @@ -1,3 +1,4 @@ +% SPDX-License-Identifier: GPL-3.0-or-later \ProvidesPackage{beamerthemeAyuTra} % this is a style was created by Nikola Ljubešić %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -97,15 +98,15 @@ size=\normalsize} \end{column} \begin{column}{.17\paperwidth} \vskip4ex - \begin{center} + \begin{center> \includegraphics[width=\linewidth]{Images/apertium_open_box_lower.jpg} - \end{center} + - \end{column} + Date: Wed, 26 Feb 2025 00:45:35 +0530 Subject: [PATCH 2/2] removed unnecessary changes in other files --- posters/eamt-2016/apertium-at-eamt2016.tex | 1 - posters/eamt-2016/beamerthemeAyuTra.sty | 45 +++++++++++----------- posters/lt4all/apertium-at-lt4all.tex | 39 +++++++++---------- posters/lt4all/beamerthemeAyuTra.sty | 13 +++---- 4 files changed, 47 insertions(+), 51 deletions(-) diff --git a/posters/eamt-2016/apertium-at-eamt2016.tex b/posters/eamt-2016/apertium-at-eamt2016.tex index 8a20dd0..d8018fd 100644 --- a/posters/eamt-2016/apertium-at-eamt2016.tex +++ b/posters/eamt-2016/apertium-at-eamt2016.tex @@ -1,4 +1,3 @@ -% SPDX-License-Identifier: GPL-3.0-or-later \documentclass[final]{beamer} % beamer 3.10: do NOT use option hyperref={pdfpagelabels=false} ! %\documentclass[final,hyperref={pdfpagelabels=false}]{beamer} % beamer 3.07: get rid of beamer warnings \mode { %% check http://www-i6.informatik.rwth-aachen.de/~dreuw/latexbeamerposter.php for examples diff --git a/posters/eamt-2016/beamerthemeAyuTra.sty b/posters/eamt-2016/beamerthemeAyuTra.sty index 25c46fb..d8c66eb 100644 --- a/posters/eamt-2016/beamerthemeAyuTra.sty +++ b/posters/eamt-2016/beamerthemeAyuTra.sty @@ -1,4 +1,3 @@ -% SPDX-License-Identifier: GPL-3.0-or-later \ProvidesPackage{beamerthemeAyuTra} % this is a style was created by Nikola Ljubešić %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -98,50 +97,50 @@ size=\normalsize} \end{column} \begin{column}{.17\paperwidth} \vskip4ex -
+ \begin{center} \includegraphics[width=\linewidth]{Images/apertium_open_box_lower.jpg} -
+ \end{center} - { %% check http://www-i6.informatik.rwth-aachen.de/~dreuw/latexbeamerposter.php for examples @@ -448,7 +447,7 @@ \end{column} - \ begin{column}{.49\textwidth} + \begin{column}{.49\textwidth} @@ -458,17 +457,17 @@ \textbf{Data sets:} English segments (\(S\)) translated into Spanish (\(\mathrm{MT}(S)\)) with MTQE labels (``GOOD'' and ``BAD'') and a collection of \textbf{baseline} features: - \ begin{table} + \begin{table} \centering - \ begin{tabular}{lp{1cm}rp{1cm}cp{1cm}c} + \begin{tabular}{lp{1cm}rp{1cm}cp{1cm}c} \toprule \textbf{data set} & & \textbf{size} & & \textbf{baseline features} & & \textbf{MTQE labels} \\ \midrule training & & 11,272 & & \cmark & & \cmark \\ development & & 1,000 & & \cmark & & \cmark \\ test & & 1,817 & & \cmark & & \xmark \\ \hline \bottomrule - \ end{tabular} - \ end{table} + \end{tabular} + \end{table} \vspace{1cm} @@ -501,54 +500,54 @@ \vspace{-1cm} - \ begin{table} + \begin{table} \centering - \ begin{tabular}{lp{1cm}rrrp{1cm}rrrp{1cm}r} + \begin{tabular}{lp{1cm}rrrp{1cm}rrrp{1cm}r} \toprule \textbf{System} & & $P^{\mathrm{BAD}}$ & $R^{\mathrm{BAD}}$ & $F_1^{\mathrm{BAD}}$ & & $P^{\mathrm{GOOD}}$ & $R^{\mathrm{GOOD}}$ & $F_1^{\mathrm{GOOD}}$ & & $F_1^{w}$ \\ \midrule SBI & & 31.2\% & 63.7\% & 41.9\% & & 88.5\% & 66.7\% & 76.1\% & & 69.5\% \\ \vspace{2mm} SBI+baseline & & 33.4\% & 60.9\% & 43.1\% & & 88.5\% & 71.1\% & 78.8\% & & 72.0\% \\ \hline \bottomrule - \ end{tabular} + \end{tabular} \label{tb:results} - \ end{table} + \end{table} Results on the \textbf{test set}: \vspace{-1cm} - \ begin{table} + \begin{table} \centering - \ begin{tabular}{lp{1cm}rrrp{1cm}rrrp{1cm}r} + \begin{tabular}{lp{1cm}rrrp{1cm}rrrp{1cm}r} \toprule \textbf{System} & & $P^{\mathrm{BAD}}$ & $R^{\mathrm{BAD}}$ & $F_1^{\mathrm{BAD}}$ & & $P^{\mathrm{GOOD}}$ & $R^{\mathrm{GOOD}}$ & $F_1^{\mathrm{GOOD}}$ & & $F_1^{w}$ \\ \midrule baseline & & --- & --- & 16.8\% & & --- & --- & 88.9\% & & 75.3\% \\ SBI & & 30.8\% & 63.9\% & 41.5\% & & 88.8\% & 66.5\% & 76.1\% & & 69.5\% \\ SBI+baseline & & 32.6\% & 63.6\% & 43.1\% & & 89.1\% & 69.5\% & 78.1\% & & 71.5\% \\ \hline \bottomrule - \ end{tabular} + \end{tabular} \label{tb:results} - \ end{table} + \end{table} - \ begin{itemize} + \begin{itemize} \item \emph{baseline:} organizers' baseline using linear regression classification on the baseline features \item \emph{SBI:} using only features from sources of bilingual information \item \emph{SBI+baseline:} combining features from sources of bilingual information and baseline features - \ end{itemize} + \end{itemize} \end{block} } \vbox to .125\textheight{% \begin{block}{{\LARGE \ding{187}} Highlights} - \ begin{itemize} + \begin{itemize} \item SBI system ranked \textbf{3rd} and SBI+baseline system ranked \textbf{1st} in the task \item Our system uses only online available sources of bilingual information \item The method is \textbf{system independent}: can be used on any kind of MT system output \item Any \textbf{other sources of bilingual information} can be easily added - \ end{itemize} + \end{itemize} \end{block} } @@ -569,11 +568,11 @@ \includegraphics[scale=0.54]{Images/logo_Marie_Curie_Actions.jpg} \hspace{3cm} \includegraphics[scale=1.3]{Images/Logotipo_del_Ministerio_de_Ciencia.png} \end{figure} - %\ begin{itemize} + %\begin{itemize} % \setlength{\itemindent}{1em} % \item Spanish government, project TIN2012-32615 (AyuTra) % \item European Commission, project PIAP-GA-2012-324414 (Abu-MaTran) - %\ end{itemize} + %\end{itemize} \end{block} } diff --git a/posters/lt4all/beamerthemeAyuTra.sty b/posters/lt4all/beamerthemeAyuTra.sty index 282175e..d8c66eb 100644 --- a/posters/lt4all/beamerthemeAyuTra.sty +++ b/posters/lt4all/beamerthemeAyuTra.sty @@ -1,4 +1,3 @@ -% SPDX-License-Identifier: GPL-3.0-or-later \ProvidesPackage{beamerthemeAyuTra} % this is a style was created by Nikola Ljubešić %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -98,15 +97,15 @@ size=\normalsize} \end{column} \begin{column}{.17\paperwidth} \vskip4ex - \begin{center> + \begin{center} \includegraphics[width=\linewidth]{Images/apertium_open_box_lower.jpg} - + \end{center} -