Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
content badge
swh:1:cnt:e5d87d3fd2c25b3838828cdbd21f7aec1d4befad

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
(requires biblatex-software package)
Generating citation ...
use Encode;
use IO::Handle;
STDOUT->autoflush();
use strict;
use utf8;
use Data::Dumper;
use Text::Levenshtein qw(distance);
use Data::Dumper;
use experimental 'smartmatch';
use locale;

######################################### Parameters #########################################

my $repIn          = "xml/in";
my $repOut          = "xml/out";##################################
my $source;
opendir(DIRIN,$repIn);
while ($source = readdir(DIRIN)) {
  if($source=~/\.xml$/){

    open( SOURCE, "<:encoding(utf8)", $repIn."/".$source );
    open( CIBLE, ">:encoding(utf8)", $repOut."/".$source );
    my $line;
    my $lemma;
    my $cat;
    my $acceptionUniq;
    my $allXML=join("",<SOURCE>);
    # while ($line = <SOURCE>){
    #
    #
    # }
    # if($allXML=~/<LST (CAT="([^"]+)"[^<>]+LEMMA="([^"]+)"[^<>]*>)/sg){
    my $cpt=0;
    my $cptSub=0;
      while($allXML=~/(<LST(\s+CAT="([^"]+)"[^<>]+?LEMMA="([^"]+?)"[^<>]*?>))/sg){
        my $empan = $1;
        my $inOpenTag=$2;
        my $lemma=$4;
        my $cat=$3;
        # print "TOKEN $5 \n";
        my $acceptionUniq="";
        if($lemma =~/^(.+?)([_A-Z\d]+)$/){
          $acceptionUniq = $1."_".$cat.$2;
          # print "LemmaComp $acceptionUniq\n";
        }
        else{
          $acceptionUniq = $lemma."_".$cat;
          # print "LemmaSimple $acceptionUniq\n";
        }
        # print "Passage $inOpenTag\n";
        if($allXML=~/\Q$empan/s){
          print "EMPAN $empan\n";
          print "SUB $inOpenTag\n";
          $cptSub++;
          $allXML=~s/\Q$empan/<LST acceptionUniq="$acceptionUniq" $inOpenTag/s;

        }
        $cpt++;
    }
    print "Lemma LST : $cpt \n";
    print "SUB LST : $cptSub \n";
    print CIBLE $allXML;


    close(SOURCE);
    close(CIBLE);
}

}

closedir(DIRIN);

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API