From 98cef5e9a772602d42acfcf233838c760424db9a Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Thu, 13 Feb 2025 18:00:17 +1100 Subject: initial commit --- comp2521/tf_idf/fileList.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 comp2521/tf_idf/fileList.h (limited to 'comp2521/tf_idf/fileList.h') diff --git a/comp2521/tf_idf/fileList.h b/comp2521/tf_idf/fileList.h new file mode 100644 index 0000000..e7afb54 --- /dev/null +++ b/comp2521/tf_idf/fileList.h @@ -0,0 +1,35 @@ +#ifndef FILELIST_C_ +#define FILELIST_C_ + +#include +#include +#include + +#include "invertedIndex.h" + +// Forward declaration for strdup in +char *strdup(const char *); + +/* + * File list node is unfortuntely defined in "invertedIndex.h": + struct FileListNode { + char *filename; + double tf; // relative tf + struct FileListNode *next; + }; +*/ + +// Returns a newly malloc'ed file list node, with fields initialised to zero. +struct FileListNode *createFileListNode(); + +// Appends a FileListNode to the end of a FileListNode linked list. +struct FileListNode *insertFileList(struct InvertedIndexNode *head, + char *const word); + +// Inserts a fileListNode into a list via ordering of tf values. If the tf +// values are equal, inserts based off the filename in ascending order. +// Returns the new head of the list. +struct FileListNode *insertFileOrderedList(struct FileListNode *head, + struct FileListNode *insert, + double mult); +#endif -- cgit v1.2.3