<commit_before>/*  Copyright (C) 2006-2008  <NAME>  [j dot mooij at science dot ru dot nl]
    Radboud University Nijmegen, The Netherlands
    
    This file is part of libDAI.

    libDAI is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    libDAI is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with libDAI; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/


#include <iostream>
#include <cstdlib>
#include <string>
#include <dai/factorgraph.h>


using namespace dai;
using namespace std;


int main( int argc, char *argv[] ) {
    if( argc != 3 ) {
        cout << "Usage: " << argv[0] << " <in.fg> <out.dot>" << endl << endl;
        cout << "Converts a .fg (FactorGraph) file to a .dot (GraphViz) file for visualization." << endl;
        cout << "The .dot file can be converted to .ps (PostScript by 'neato -T ps out.dot > out.ps'" << endl;
        return 1;
    } else {
        // Read factorgraph
        FactorGraph fg;
        char *infile = argv[1];

        if( fg.ReadFromFile( infile ) ) {
            cerr << "Error reading file " << infile << endl;
            return 2;
        } else {
            if( string( argv[2] ) == "-" ) 
                fg.WriteToDotFile( argv[2] );
            else {<commit_msg>Fixed little bug in fg2dot.cpp<commit_after>/*  Copyright (C) 2006-2008  <NAME>  [j dot mooij at science dot ru dot nl]
    Radboud University Nijmegen, The Netherlands
    
    This file is part of libDAI.

    libDAI is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    libDAI is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with libDAI; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/


#include <iostream>
#include <cstdlib>
#include <string>
#include <dai/factorgraph.h>


using namespace dai;
using namespace std;


int main( int argc, char *argv[] ) {
    if( argc != 3 ) {
        cout << "Usage: " << argv[0] << " <in.fg> <out.dot>" << endl << endl;
        cout << "Converts a .fg (FactorGraph) file to a .dot (GraphViz) file for visualization." << endl;
        cout << "The .dot file can be converted to .ps (PostScript by 'neato -T ps out.dot > out.ps'" << endl;
        return 1;
    } else {
        // Read factorgraph
        FactorGraph fg;
        char *infile = argv[1];

        if( fg.ReadFromFile( infile ) ) {
            cerr << "Error reading file " << infile << endl;
            return 2;
        } else {
            if( string( argv[2] ) != "-" ) 
                fg.WriteToDotFile( argv[2] );
            else {
{'fraction_non_alphanumeric': 0.09406081273088945, 'fraction_numerical': 0.01562944018186985, 'mean_word_length': 2.4645669291338583, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 19, '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': '6370264', 'n_tokens_mistral': 1062, 'n_tokens_neox': 1017, 'n_words': 452}