<commit_before>package fm

import (
	"go/ast"
	"go/format"
	"go/token"
	"os"
)

type ASTWriter interface {
	Write(file *ast.File, filename string) error
}

type DiskASTWriter struct{}

func (d *DiskASTWriter) Write(file *ast.File, filename string) error {
	spyFile, err := os.Create(filename)
	if err != nil {
		return err
	}

	return format.Node(spyFile, token.NewFileSet(), file)
}
<commit_msg>Add missing documentation to exported types<commit_after>package fm

import (
	"go/ast"
	"go/format"
	"go/token"
	"os"
)

// ASTWriter writes the ast.File to the provided filename
type ASTWriter interface {
	Write(file *ast.File, filename string) error
}

// DiskASTWriter saves an AST to disk
type DiskASTWriter struct{}

// Write outputs the ast.File to a file on disk specified by filename
func (d *DiskASTWriter) Write(file *ast.File, filename string) error {
	spyFile, err := os.Create(filename)
	if err != nil {
		return err
	}

	return format.Node(spyFile, token.NewFileSet(), file)
}

{'fraction_non_alphanumeric': 0.11538461538461539, 'fraction_numerical': 0.0, 'mean_word_length': 4.288770053475936, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '52824', 'n_tokens_mistral': 351, 'n_tokens_neox': 336, 'n_words': 107}