Documentation
¶
Overview ¶
Example ¶
package main import ( "fmt" paperswithcode_go "github.com/codingpot/paperswithcode-go/v2" ) func main() { c := paperswithcode_go.NewClient() papers, _ := c.PaperList(paperswithcode_go.PaperListParamsDefault()) fmt.Println(len(papers.Results)) gan, _ := c.PaperGet(paperswithcode_go.GetPaperIDFromPaperTitle("Generative Adversarial Networks")) fmt.Println(gan.Title) fmt.Println(gan.Authors) }
Output: 50 Generative Adversarial Networks [Ian J. Goodfellow Jean Pouget-Abadie Mehdi Mirza Bing Xu David Warde-Farley Sherjil Ozair Aaron Courville Yoshua Bengio]
Index ¶
- Constants
- func GetPaperIDFromPaperTitle(paperTitle string) string
- type Client
- func (c *Client) PaperGet(paperID string) (*models.Paper, error)
- func (c *Client) PaperList(params PaperListParams) (*models.PaperList, error)
- func (c *Client) PaperMethodList(paperID string) (*models.MethodList, error)
- func (c *Client) PaperRepositoryList(paperID string) (*models.RepositoryList, error)
- func (c *Client) PaperResultList(paperID string) (*models.ResultList, error)
- func (c *Client) PaperTaskList(paperID string) (*models.TaskList, error)
- type ClientOption
- type PaperListParams
Examples ¶
Constants ¶
const (
BaseURL = "https://paperswithcode.com/api/v1"
)
Variables ¶
This section is empty.
Functions ¶
func GetPaperIDFromPaperTitle ¶
GetPaperIDFromPaperTitle generates a paper ID from paper title. WARNING: This function does not cover all cases.
Example ¶
paperTitle := "Generative Adversarial Networks" fmt.Println(GetPaperIDFromPaperTitle(paperTitle))
Output: generative-adversarial-networks
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) PaperGet ¶
PaperGet returns a single paper. Note that paperID is hyphen cased (e.g., generative-adversarial-networks).
func (*Client) PaperList ¶
func (c *Client) PaperList(params PaperListParams) (*models.PaperList, error)
PaperList returns multiple papers.
func (*Client) PaperMethodList ¶
func (c *Client) PaperMethodList(paperID string) (*models.MethodList, error)
PaperMethodList returns the methods used in the given paper.
func (*Client) PaperRepositoryList ¶
func (c *Client) PaperRepositoryList(paperID string) (*models.RepositoryList, error)
PaperRepositoryList returns repositories related to the given paper.
func (*Client) PaperResultList ¶
func (c *Client) PaperResultList(paperID string) (*models.ResultList, error)
PaperResultList returns the evaluation results of the paper.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption can be used to swap the default http client or swap the API key
func WithAPIToken ¶
func WithAPIToken(apiToken string) ClientOption
WithAPIToken sets the client API token.
type PaperListParams ¶
type PaperListParams struct { // Query to search papers (default: "") // If empty, it returns all papers. Query string // Page is the number of page to search (default: 1) Page int // Limit returns how many papers are returned in a single response. Limit int }
PaperListParams is the parameter for PaperList method.
func PaperListParamsDefault ¶
func PaperListParamsDefault() PaperListParams
PaperListParamsDefault returns the default PaperListParams.