diff options
Diffstat (limited to 'comp2521/tf_idf/fileList.h')
| -rw-r--r-- | comp2521/tf_idf/fileList.h | 35 |
1 files changed, 35 insertions, 0 deletions
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 <stdbool.h> +#include <stdlib.h> +#include <string.h> + +#include "invertedIndex.h" + +// Forward declaration for strdup in <string.h> +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 |
